Skip to content

Commit 6e73fbf

Browse files
Merge pull request #312965 from EldertGrootenboer/jms-jakarta-ee-docs
Add Jakarta EE support documentation for Service Bus JMS library
2 parents b23d8bc + d014617 commit 6e73fbf

2 files changed

Lines changed: 71 additions & 7 deletions

File tree

articles/service-bus-messaging/how-to-use-java-message-service-20.md

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,52 @@ ms.custom:
1313
This article explains how to use the popular **Java Message Service (JMS) 2.0** API to interact with Azure Service Bus over the Advanced Message Queueing Protocol (AMQP) 1.0 protocol.
1414

1515
## Important notes
16-
Here are a few important points:
1716

18-
- Support for JMS 2.0 API is available only in the premium tier and when you use the **azure-servicebus-jms** library.
19-
- If you use JMS libraries other than **azure-servicebus-jms** (for example, latest **qpid-jms-client**) against a premium namespace, you observe the **JMS 1.1** behavior, and some of the JMS 2.0 features might not work as expected. The azure-servicebus-jms library doesn't create a vendor lock of any kind as it still takes a dependency on qpid-jms-client. All APIs that work on qpid-jms-client work on azure-servicebus-jms library as well.
20-
- The azure-servicebus-jms is also an [open-source library](https://github.com/azure/azure-servicebus-jms). The azure-servicebus-jms library was mainly created so that the Service Bus service can distinguish between customers needing the JMS 1.1 behavior (backwards compatibility) versus the JMS 2.0 behavior when working against a premium namespace. The azure-servicebus-jms library also provides some necessary defaults such as prefetch policy values, reconnect policies, Microsoft Entra ID, Managed Identity support, support for Auto Delete on Idle for entities out of the box.
21-
- The following path to the azure-servicebus-jms package is the latest version of the library that is based on the Jakarta Messaging specification (Jakarta.* APIs): Maven Central: [com.azure:azure-servicebus-jms](https://central.sonatype.com/artifact/com.azure/azure-servicebus-jms). And, the following path to the azure-servicebus-jms is the latest version of library before the Jakarta Messaging specification (javax.* APIs): Maven Central: [com.microsoft.azure:azure-servicebus-jms](https://central.sonatype.com/artifact/com.microsoft.azure/azure-servicebus-jms/versions).
17+
- JMS 2.0 API support requires the **Azure Service Bus Premium tier** and the **azure-servicebus-jms** library. Using other JMS libraries (for example, **qpid-jms-client** directly) against a premium namespace results in JMS 1.1 behavior, and some JMS 2.0 features might not work as expected.
18+
- The library is [open source](https://github.com/azure/azure-servicebus-jms) and built on top of **qpid-jms-client** — all qpid-jms-client APIs work with it, so there is no vendor lock-in. It also provides defaults for prefetch policies, reconnect policies, Microsoft Entra ID, Managed Identity support, and Auto Delete on Idle.
19+
- The library is available in two variants for **Jakarta EE** and **Java EE**. See [Jakarta EE and javax support](#jakarta-ee-and-javax-support) for details on which artifact to use.
20+
21+
## Jakarta EE and javax support
22+
23+
The `azure-servicebus-jms` library is available in two variants to support both the legacy Java EE (`javax.jms`) and the newer Jakarta EE (`jakarta.jms`) API namespaces.
24+
25+
| API namespace | Maven artifact | Versions | JMS specification |
26+
|---|---|---|---|
27+
| `jakarta.jms` (Jakarta EE 9+) | [com.azure:azure-servicebus-jms](https://central.sonatype.com/artifact/com.azure/azure-servicebus-jms) | 2.0.0+ | Jakarta Messaging (JMS 2.0) |
28+
| `javax.jms` (Java EE) | [com.microsoft.azure:azure-servicebus-jms](https://central.sonatype.com/artifact/com.microsoft.azure/azure-servicebus-jms/versions) | 1.0.x | JMS 2.0 |
29+
30+
**Which artifact should I use?**
31+
32+
- If your project uses **Jakarta EE 9 or later** (for example, Spring Boot 3.x, Quarkus 3.x, or any framework that imports `jakarta.jms.*`), use the `com.azure` artifact:
33+
34+
```xml
35+
<dependency>
36+
<groupId>com.azure</groupId>
37+
<artifactId>azure-servicebus-jms</artifactId>
38+
<version>2.0.0</version>
39+
</dependency>
40+
```
41+
42+
- If your project still uses **Java EE** (imports `javax.jms.*`), continue using the `com.microsoft.azure` artifact:
43+
44+
```xml
45+
<dependency>
46+
<groupId>com.microsoft.azure</groupId>
47+
<artifactId>azure-servicebus-jms</artifactId>
48+
<version>1.0.2</version>
49+
</dependency>
50+
```
51+
52+
> [!IMPORTANT]
53+
> Do not mix the two artifacts. Using `com.azure:azure-servicebus-jms` in a project that imports `javax.jms.*` results in compilation errors, and vice versa.
54+
55+
**Migrating from javax to Jakarta**
56+
57+
If you're upgrading your application from Java EE to Jakarta EE:
58+
59+
1. Replace your Maven dependency group ID from `com.microsoft.azure` to `com.azure` and update the version to `2.0.0` or later.
60+
2. Update all `javax.jms.*` imports in your code to `jakarta.jms.*`.
61+
3. The `ServiceBusJmsConnectionFactory` API and configuration remain the same across both variants, so no code changes are needed beyond the import and dependency updates.
2262

2363
## Prerequisites
2464

@@ -42,10 +82,30 @@ To learn more about how to prepare your developer environment for Java on Azure,
4282

4383
## Downloading the Java Message Service (JMS) client library
4484

45-
To utilize all the features available in the premium tier, add the following library to the build path of the project: [azure-servicebus-jms](https://central.sonatype.com/artifact/com.microsoft.azure/azure-servicebus-jms/1.0.0). This package provides some necessary defaults such as prefetch policy values, reconnect policies, Microsoft Entra ID, and Managed Identity support out of the box.
85+
To utilize all the features available in the premium tier, add the **azure-servicebus-jms** library to the build path of your project. This package provides necessary defaults such as prefetch policy values, reconnect policies, Microsoft Entra ID, and Managed Identity support out of the box. Choose the artifact that matches your project's API namespace (see [Jakarta EE and javax support](#jakarta-ee-and-javax-support) for details):
86+
87+
**Jakarta EE (jakarta.jms):**
88+
89+
```xml
90+
<dependency>
91+
<groupId>com.azure</groupId>
92+
<artifactId>azure-servicebus-jms</artifactId>
93+
<version>2.0.0</version>
94+
</dependency>
95+
```
96+
97+
**Java EE (javax.jms):**
98+
99+
```xml
100+
<dependency>
101+
<groupId>com.microsoft.azure</groupId>
102+
<artifactId>azure-servicebus-jms</artifactId>
103+
<version>1.0.2</version>
104+
</dependency>
105+
```
46106

47107
> [!NOTE]
48-
> To add the [azure-servicebus-jms](https://central.sonatype.com/artifact/com.microsoft.azure/azure-servicebus-jms/1.0.0) to the build path, use the preferred dependency management tool for your project like [Maven](https://maven.apache.org/) or [Gradle](https://gradle.org/).
108+
> To add the library to the build path, use the preferred dependency management tool for your project like [Maven](https://maven.apache.org/) or [Gradle](https://gradle.org/).
49109
50110
## Coding Java applications
51111

articles/service-bus-messaging/jms-developer-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ The below building blocks are available to communicate with the JMS application.
5050
>
5151
5252
### Connection factory
53+
54+
> [!NOTE]
55+
> The `azure-servicebus-jms` library is available in two variants: `com.azure:azure-servicebus-jms` (version 2.0.0+) for **Jakarta EE** (`jakarta.jms.*`) and `com.microsoft.azure:azure-servicebus-jms` (version 1.0.x) for **Java EE** (`javax.jms.*`). For guidance on choosing the right artifact, see [Jakarta EE and javax support](how-to-use-java-message-service-20.md#jakarta-ee-and-javax-support).
56+
5357
The connection factory object is used by the client to connect with the JMS provider. The connection factory encapsulates a set of connection configuration parameters that are defined by the administrator.
5458

5559
Each connection factory is an instance of `ConnectionFactory`, `QueueConnectionFactory`, or `TopicConnectionFactory` interface.

0 commit comments

Comments
 (0)