Microsoft Azure has made Azure Service Bus generally available for its customers in the form of Java client library version1.0.0. It’s similar to .NET standard client library and customers can get the best use of as it comes with native functionality. Now the Java customers can enjoy a solid experience of Java and send scheduled messages to native clients is more a big deal. Moreover, you can also ensure the order of messages by using sessions on Standards or premium plans. The best part of Azure Service Bus Java is the availability for both Java and .NET clients due to the full support and interaction with Azure Service Bus.

azure service bus java

Samples of Service Bus Java:

Before sharing the samples of Service Bus Java, you should note down the prerequisites required to run these samples. Java 8, an Azure Bus Subscription, a Service Bus queue, a Service Bus namespace, and a Service Bus topic are necessary for testing the samples of Service Bus Java. Here are the examples of queue samples and topic samples, but don’t forget to change bracketed values in the [sample]. java file.

For Queue Sample

private static final String connectionString = “{connection string}”;

   private static final String queueName = “{queue name}”;

For Topic Sample

private static final String connectionString = “{connection string}”;   private static final String topicName = “{topic name}”;   private static final String subscriptionName = “{subscription name}”;

Links to Important Samples:

  • QueueClient is used for sending and receiving messages which run on MessagePump model to ensure the simplicity of the process. Check the demonstration from this sample.
  • You can also send and receive messages by using Topic Client and Subscription Client. It also uses MessageHandler known as MessagePump. Click on this sample for further details.
  • This sample lets you know how to use Service Bus Queue to send and receive messages by providing full control over the process to the client.
  • Service Bus Java Client allows the user to send and receive messages with Qpid JMS and receive with Service Bus Java Client. This sample is available for BytesMessageds support only and Microsoft Team is making efforts to introduce more feature in it.