1- # Guide for migrating to azure-messaging-servicebus
1+ # Guide for migrating to com. azure: azure -messaging-servicebus from com.microsoft.azure : azure -servicebus
22
3- This guide assists in the migration to version 7 of the Service Bus client library
3+ This guide is intended to assist in the migration to
44[ ` com.azure:azure-messaging-servicebus ` ] ( https://search.maven.org/artifact/com.azure/azure-messaging-servicebus ) from
55version 3 of
66[ ` com.microsoft.azure:azure-servicebus ` ] ( https://search.maven.org/artifact/com.microsoft.azure/azure-servicebus/ ) . It
@@ -11,24 +11,24 @@ library for Java, please refer to the
1111[ README] ( https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/servicebus/azure-messaging-servicebus/README.md )
1212and [ Service Bus
1313samples] ( https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus )
14- for the ` azure-messaging-servicebus ` library rather than this guide.
14+ for the ` com.azure: azure-messaging-servicebus` library rather than this guide.
1515
1616## Table of contents
1717
18- - [ Guide for migrating to azure-messaging-servicebus ] ( #guide-for-migrating-to-azure-messaging-servicebus )
19- - [ Table of contents ] ( #table-of-contents )
20- - [ Migration benefits ] ( #migration-benefits )
21- - [ General changes] ( #general -changes )
22- - [ Group id, artifact id, and package names] ( #group-id-artifact-id-and-package-names )
23- - [ Client hierarchy] ( #client-hierarchy )
24- - [ Async programming model] ( #async-programming-model )
25- - [ Connection Pooling] ( #connection-pooling )
26- - [ Migration Samples ] ( #migration-samples )
27- - [ Instantiating clients ] ( #instantiating-clients )
28- - [ Sending messages] ( #sending -messages )
29- - [ Receiving messages ] ( #receiving-messages )
30- - [ Working with sessions ] ( #working-with-sessions )
31- - [ Additional samples] ( #additional-samples )
18+ - [ Migration benefits ] ( #migration-benefits )
19+ - [ Cross Service SDK improvements ] ( #cross-service-sdk-improvements )
20+ - [ New features ] ( #new-features )
21+ - [ Important changes] ( #important -changes )
22+ - [ Group id, artifact id, and package names] ( #group-id-artifact-id-and-package-names )
23+ - [ Client hierarchy] ( #client-hierarchy )
24+ - [ Async programming model] ( #async-programming-model )
25+ - [ Connection Pooling] ( #connection-pooling )
26+ - [ Instantiating clients ] ( #instantiating-clients )
27+ - [ Sending messages ] ( #sending-messages )
28+ - [ Receiving messages] ( #receiving -messages )
29+ - [ Working with sessions ] ( #working-with-sessions )
30+ - [ Upcoming features ] ( #upcoming-features )
31+ - [ Additional samples] ( #additional-samples )
3232
3333## Migration benefits
3434
@@ -43,24 +43,36 @@ naming, and API structure. Additionally, many developers have felt that the lear
4343did not offer a good, approachable, and consistent onboarding story for those learning Azure or exploring a specific
4444Azure service.
4545
46- To improve the development experience across Azure services, including Service Bus, a set of uniform [ design
46+ To try and improve the development experience across Azure services, including Service Bus, a set of uniform [ design
4747guidelines] ( https://azure.github.io/azure-sdk/general_introduction.html ) was created for all languages to drive a
4848consistent experience with established API patterns for all services. A set of [ Java specific
4949guidelines] ( https://azure.github.io/azure-sdk/java_introduction.html ) was also introduced to ensure that Java clients
5050have a natural and idiomatic feel that mirrors that of Java developers. Further details are available in the guidelines
5151for those interested.
5252
53+ ### Cross Service SDK improvements
54+
5355The new Service Bus library ` azure-messaging-servicebus ` provides the ability to share in some of the cross-service
54- improvements made to the Azure development experience, such as using the new ` azure-identity ` library to share a single
55- authentication between clients and a unified diagnostics pipeline offering a common view of the activities across each
56- of the client libraries.
56+ improvements made to the Azure development experience, such as
57+
58+ - Using the new ` azure-identity ` library to share a single authentication between clients.
59+ - Dedicated clients for sync and async operations with the client.
60+ - Use of builders to build the client.
61+ - A unified diagnostics pipeline offering a common view of the activities across each of the client libraries.
62+
5763
5864While we believe that there is significant benefit to adopting the new Service Bus library ` azure-messaging-servicebus ` ,
5965it is important to be aware that the previous version ` azure-servicebus ` have not been officially deprecated. They will
6066continue to be supported with security and bug fixes as well as receiving some minor refinements. However, in the near
6167future they will not be under active development and new features are unlikely to be added to them.
6268
63- ## General changes
69+ ### New features
70+
71+ - Ability to create a batch of messages with the smarter ` ServiceBusSenderClient.createMessageBatch() ` and
72+ ` ServiceBusMessageBatch.tryAddMessage() ` APIs. This will help manage the messages to be sent in the most optimal way.
73+ - The clients created using one ` ServiceBusClientBuilder ` instance shares AMQP connection implicitly.
74+
75+ ## Important changes
6476
6577### Group id, artifact id, and package names
6678
@@ -79,8 +91,15 @@ As part of the new Java SDK guidelines, all clients are instantiated from a buil
7991Each client is expected to have a sync and async version that can be instantiated via ` buildAsyncClient() ` or ` buildClient() ` methods
8092on the builder.
8193
82- In the new Service Bus library, this single entry point is the ` ServiceBusClientBuilder ` which can be used to create sender and receiver
83- clients to the queue/topic/subscription/session of your choice and start sending/receiving messages.
94+ #### Approachability
95+
96+ By having a single entry point, the ` ServiceBusClientBuilder ` which can be used to create sender, receiver and processor
97+ clients to the queue/topic/subscription/session of your choice and start sending/receiving messages.
98+
99+ #### Consistency
100+
101+ We now have methods with similar names, signature and location to create senders, receivers and processor. This provides
102+ consistency and predictability on the various features of the library.
84103
85104### Async programming model
86105
@@ -102,14 +121,20 @@ By making this connection sharing be implicit to a `ServiceBusClientBuilder` ins
102121applications will not use multiple connections unless they explicitly opt in by creating multiple client builder
103122instances.
104123
105- ## Migration Samples
106-
107124### Instantiating clients
108125
109126While we continue to support connection strings when constructing a client, the main difference is when using Azure
110127Active Directory. We now use the new [ azure-identity] ( https://search.maven.org/artifact/com.azure/azure-identity )
111128library to share a single authentication solution between clients of different Azure services.
112129
130+ Previously, in ` azure-servicebus ` , you can create client as shown below.
131+
132+ ``` java
133+ String connectionString = " Endpoint=sb://yournamespace.servicebus.windows.net/;SharedAccessKeyName=your-key-name;SharedAccessKey=your-key" ;
134+ QueueClient client = new QueueClient (new ConnectionStringBuilder (connectionString, " my-queue" ), ReceiveMode . PEEKLOCK );
135+ ```
136+ Now in ` azure-messaging-servicebus ` , you start with ` ServiceBusClientBuilder ` and create all the clients.
137+
113138``` java
114139// Create a sender client that will authenticate through Active Directory
115140TokenCredential credential = new DefaultAzureCredentialBuilder ()
@@ -370,8 +395,14 @@ ServiceBusSessionReceiverClient sessionClient = new ServiceBusClientBuilder()
370395
371396ServiceBusReceiverClient receiverClient = sessionClient. acceptSession(" my-session-id" );
372397```
398+ ## Upcoming features
399+ - [ Cross entity transactions] ( https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via )
400+ to support transaction across different entities.
401+ - [ Different AMQP body section] ( https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-amqp-sequence )
402+ support for 'Amqp Sequence' and 'Amqp Value'.
403+
404+ ![ Impressions] ( https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fservicebus%2Fservice-bus%2FMIGRATIONGUIDE.png )
373405
374406## Additional samples
375407
376- More examples can be found at:
377- - [ Service Bus samples] ( https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus )
408+ More examples can be found at [ Service Bus samples] ( https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/servicebus/azure-messaging-servicebus/src/samples/java/com/azure/messaging/servicebus ) .
0 commit comments