WitiQ.MessageBroker.Pulsar.DependencyInjection
1.0.0
dotnet add package WitiQ.MessageBroker.Pulsar.DependencyInjection --version 1.0.0
NuGet\Install-Package WitiQ.MessageBroker.Pulsar.DependencyInjection -Version 1.0.0
<PackageReference Include="WitiQ.MessageBroker.Pulsar.DependencyInjection" Version="1.0.0" />
<PackageVersion Include="WitiQ.MessageBroker.Pulsar.DependencyInjection" Version="1.0.0" />
<PackageReference Include="WitiQ.MessageBroker.Pulsar.DependencyInjection" />
paket add WitiQ.MessageBroker.Pulsar.DependencyInjection --version 1.0.0
#r "nuget: WitiQ.MessageBroker.Pulsar.DependencyInjection, 1.0.0"
#:package WitiQ.MessageBroker.Pulsar.DependencyInjection@1.0.0
#addin nuget:?package=WitiQ.MessageBroker.Pulsar.DependencyInjection&version=1.0.0
#tool nuget:?package=WitiQ.MessageBroker.Pulsar.DependencyInjection&version=1.0.0
WitiQ.MessageBroker.Pulsar
A modern, robust .NET 8 library for integrating Apache Pulsar into your .NET applications. Includes support for dependency injection, background consumers, health checks, and flexible configuration.
Features
- .NET 8 and async/await support
- Producer and consumer abstractions for Apache Pulsar
- Background consumer services with dependency injection
- Health checks for Pulsar connectivity
- Flexible configuration via
appsettings.jsonor code - TLS and token authentication support
- Logging via Microsoft.Extensions.Logging
- Automatic resource management and graceful shutdown
Getting Started
Prerequisites
- .NET 8 SDK
- Apache Pulsar server (local or remote)
- DotPulsar (handled via NuGet)
Installation
Add the NuGet packages to your project:
<PackageReference Include="WitiQ.MessageBroker.Pulsar.Core" Version="1.0.0" /> <PackageReference Include="WitiQ.MessageBroker.Pulsar.Extensions.Hosting" Version="1.0.0" />
Configuration
Add your Pulsar settings to appsettings.json:
{ "WitiQPulsar": { "ServiceUrl": "pulsar://localhost:6650", "OperationTimeout": "00:00:30", "ConnectionTimeout": "00:00:10", "UseTls": false, "Authentication": { "Token": "" } } }
Usage
Registering Services
public void ConfigureServices(IServiceCollection services) { services.AddWitiQPulsar(Configuration.GetSection("WitiQPulsar")); services.AddWitiQPulsarHealthChecks(); }
Sending Messages
public class MessageSender { private readonly IWitiQPulsarFactory _factory; public MessageSender(IWitiQPulsarFactory factory) { _factory = factory; }
public async Task SendAsync(string message) { using var producer = await _factory.CreateProducerAsync<string>("my-topic"); await producer.SendAsync(message); } }
Consuming Messages in Background
public class MyMessageHandler : IWitiQPulsarMessageHandler<string> { public async Task HandleAsync(WitiQPulsarMessage<string> message, CancellationToken cancellationToken) { // Process the message await Task.CompletedTask; } } // Register the background consumer service services.AddWitiQPulsarConsumerBackgroundService<string, MyMessageHandler>( "my-topic", "my-subscription");
Health Checks
Integrate with ASP.NET Core health checks:
app.UseHealthChecks("/health");
Logging
Configure logging as usual with Microsoft.Extensions.Logging:
services.AddLogging(builder ⇒ { builder.AddConsole(); builder.SetMinimumLevel(LogLevel.Debug); });
Testing
Run all unit tests with:
dotnet test
Security
- TLS: Set
UseTlstotrueand provide certificate paths in configuration. - Authentication: Provide a valid Pulsar token in the
Authenticationsection.
Contributing
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
License
This project is licensed under the MIT License.
Credits
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DotPulsar (>= 4.3.0)
- Microsoft.Extensions.Configuration (>= 9.0.6)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.6)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.6)
- Microsoft.Extensions.Options (>= 9.0.6)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.6)
- WitiQ.MessageBroker.Pulsar (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 257 | 6/24/2025 |