Class ServiceBusAdministrationClient

java.lang.Object
com.azure.messaging.servicebus.administration.ServiceBusAdministrationClient

public final class ServiceBusAdministrationClient extends Object
A synchronous client for managing a Service Bus namespace.

Create a queue

 QueueProperties queue = client.createQueue("my-new-queue");
 System.out.printf("Queue created. Name: %s. Lock Duration: %s.%n",
     queue.getName(), queue.getLockDuration());
 

Edit an existing subscription

 // To update the subscription we have to:
 // 1. Get the subscription info from the service.
 // 2. Update the SubscriptionProperties we want to change.
 // 3. Call the updateSubscription() with the updated object.
 SubscriptionProperties subscription = client.getSubscription("my-topic", "my-subscription");

 System.out.println("Original delivery count: " + subscription.getMaxDeliveryCount());

 // Updating it to a new value.
 subscription.setMaxDeliveryCount(5);

 // Persisting the updates to the subscription object.
 SubscriptionProperties updated = client.updateSubscription(subscription);

 System.out.printf("Subscription updated. Name: %s. Delivery count: %s.%n",
     updated.getSubscriptionName(), updated.getMaxDeliveryCount());
 

List all queues

 client.listQueues().forEach(queue -> {
     System.out.printf("Queue [%s]. Lock Duration: %s.%n",
         queue.getName(), queue.getLockDuration());
 });
 
See Also: