WitiQ.MessageBroker.Pulsar 1.0.0

dotnet add package WitiQ.MessageBroker.Pulsar --version 1.0.0
                    
NuGet\Install-Package WitiQ.MessageBroker.Pulsar -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WitiQ.MessageBroker.Pulsar" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WitiQ.MessageBroker.Pulsar" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WitiQ.MessageBroker.Pulsar" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WitiQ.MessageBroker.Pulsar --version 1.0.0
                    
#r "nuget: WitiQ.MessageBroker.Pulsar, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WitiQ.MessageBroker.Pulsar@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WitiQ.MessageBroker.Pulsar&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WitiQ.MessageBroker.Pulsar&version=1.0.0
                    
Install as a Cake Tool

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.json or 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 UseTls to true and provide certificate paths in configuration.
  • Authentication: Provide a valid Pulsar token in the Authentication section.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on WitiQ.MessageBroker.Pulsar:

Package Downloads
WitiQ.MessageBroker.Pulsar.Hosting

Hosting extensions for WitiQ Pulsar Message Broker

WitiQ.MessageBroker.Pulsar.DependencyInjection

Dependency Injection extensions for WitiQ Pulsar Message Broker

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 158 6/24/2025