The official .NET/C# client library for Apache Pulsar

Clone this repo:
  1. 814d366 Adding PackageIcon and removing the ReaderChannelFactory by Daniel Blankensteiner · 11 days ago master
  2. 22ff109 Make ready for 0.11.0 by Daniel Blankensteiner · 13 days ago 0.11.0
  3. 2541edf Compression wired up and seems to work. Needs more testing. by Daniel Blankensteiner · 2 weeks ago
  4. cbaa924 Implemented compression using LZ4 (K4os.Compression.LZ4), Snappy (IronSnappy), Zlib (DotNetZip) and Zstd (ZstdNet). Just need to wire it up, test it and create documentation. This will be in the next release. by Daniel Blankensteiner · 2 weeks ago
  5. 5ab2a73 Implementing tracing using the ActivitySource and Activity. This is still work in progress. by Daniel Blankensteiner · 3 weeks ago

# DotPulsar

CI - Unit

The official .NET/C# client library for Apache Pulsar.

DotPulsar is written entirely in C# and implements Apache Pulsar's binary protocol.

What's new?

Have a look at the changelog.

Getting Started

Let's take a look at a “Hello world” example, where we first produce a message and then consume it.

Install the NuGet package DotPulsar and copy/paste the code below (you will be needing using declarations for ‘DotPulsar’ and ‘DotPulsar.Extensions’).

const string myTopic = "persistent://public/default/mytopic";

await using var client = PulsarClient.Builder()
                                     .Build(); //Connecting to pulsar://localhost:6650

var producer = client.NewProducer()
                     .Topic(myTopic)
                     .Create();

_ = await producer.Send(Encoding.UTF8.GetBytes("Hello World"));

var consumer = client.NewConsumer()
                     .SubscriptionName("MySubscription")
                     .Topic(myTopic)
                     .Create();

await foreach (var message in consumer.Messages())
{
    Console.WriteLine("Received: " + Encoding.UTF8.GetString(message.Data.ToArray()));
    await consumer.Acknowledge(message);
}

For a more in-depth tour of the API, please visit the Wiki.

Supported features

  • [X] Service discovery
  • [X] Automatic reconnect
  • [X] TLS connections
  • [X] TLS Authentication
  • [X] JSON Web Token Authentication
  • [X] Producer send with custom metadata
  • [X] Producer send with event time, sequence id, and delayed message delivery
  • [X] Producer send with key and ordering key
  • [X] Consumer subscription with initial position and priority level
  • [X] Consumer subscription types exclusive, shared, failover, and key shared
  • [X] Consumer receive and single + cumulative acknowledge
  • [X] Consumer and Reader seek on message-id and publish time
  • [X] Consumer unsubscribe
  • [X] Consume compacted topics
  • [X] Reader API
  • [X] Read/Consume/Acknowledge batched messages
  • [X] Pulsar Proxy
  • [X] LZ4 message compression
  • [X] ZLIB message compression
  • [X] ZSTD message compression
  • [X] SNAPPY message compression

Roadmap

Help prioritizing the roadmap is most welcome, so please reach out and tell us what you want and need.

Join Our Community

Apache Pulsar has a Slack instance and there you'll find us in the #dev-dotpulsar channel. Just waiting for you to pop by :-)

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.