共用方式為


Service Bus libraries for Java

Overview

Service Bus provides highly reliable queues and publish/subscribe topics with deep feature capabilities such as ordered delivery, sessions, partitioning, scheduling, complex subscriptions, as well as workflow and transaction handling.

Learn more about Service Bus concepts in the messaging documentation section.

For Java developers, Service Bus provides a Microsoft supported native API and Service Bus can also be used with AMQP 1.0 compliant libraries such as Apache Qpid Proton's JMS provider.

Libraries for resource management

Create and manage namespaces, topics, queues, subscriptions and rules using Azure Resource Manager.

Use the Management API in your project:
Add a dependency to your Maven pom.xml file to use the management API in your project.

Maven Package Reference Samples
azure-mgmt-servicebus API Reference Manage Service Bus queues, Create and subscribe to Service Bus topics
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-mgmt-servicebus</artifactId>
    <version>1.38.0</version>
</dependency>

Libraries for data access

Use data access libraries to send and receive messages from Service Bus queues, topics and subscriptions. You can also use these libraries to manage queues, topics, subscriptions and rules in a given namespace. There are two libraries available that provide these features at the moment.

Add a dependency to your Maven pom.xml file to use the client library in your project. Specify the version as desired.

Maven Package Reference Samples GitHub
azure-messaging-servicebus (latest) API Reference Samples Source code for azure-messaging-servicebus
microsoft-azure-servicebus (legacy) API Reference Samples Source code for microsoft-azure-servicebus

azure-messaging-servicebus

This is the latest SDK for Azure Service Bus for sending and receiving messages available as of December 2020. To manage queues, topics, subscriptions and rules use the ServiceBusAdministrationClient in this package.

If you are using the older com.microsoft.azure:azure-servicebus package, please consider upgrading. Read the migration guide at for more details.

Add dependency in your pom.xml.

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-messaging-servicebus</artifactId>
    <version>7.0.0</version>
</dependency>

microsoft-azure-servicebus

This is the older SDK for Azure Service Bus. Please note, the newer package com.azure:azure-messaging-servicebus is available as of December 2020. While the older com.microsoft.azure:azure-servicebus package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at for more details.

Add dependency in your pom.xml.

<dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-servicebus</artifactId>
  <version>3.5.1</version>
</dependency>

Explore more sample Java code for Azure Service Bus you can use in your apps.