Skip to content

Code-Sharp/StompSharp

Repository files navigation

StompSharp

C# (.net) Stomp Client.

MasterProvider
Build StatusMono CI Provided by travis-ci

Usage

Registering to messages :

using (IStompClient client = new StompClient("localhost", 61613)){var autoAck = client.SubscriptionBehaviors.AutoAcknowledge; using (IDestination<IMessage> destination = client.GetDestination("/queue/a",autoAck)){using (destination.IncommingMessages.Subscribe(Console.WriteLine)){Console.WriteLine("Messages are written to console. Press any key to unsubscribe and exit."); Console.ReadKey()} } } 

Please note that you can change a subscription behavior from auto, client, client-individual.

Sending messages :

using (IStompClient client = new StompClient("localhost", 61613)){var autoAck = client.SubscriptionBehaviors.AutoAcknowledge; using (IDestination<IMessage> destination = client.GetDestination("/queue/a",autoAck)){var messageToSend = new BodyOutgoingMessage(new byte[1024]); await destination.SendAsync(messageToSend, NoReceiptBehavior.Default)} } 

The task that returned from SendAsync will complete when the message is sent to the server, You can switch to ReceiptBehavior and then the task will be completed when a receipt is received from the server.

About

C# (.net) Stomp Client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published