Skip to content

Commit 9a02a13

Browse files
Merge pull request #280875 from spelluru/sbusfeedback0715
Service Bus feedback
2 parents ac87317 + 0fceea0 commit 9a02a13

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

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

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ ms.custom: devx-track-extended-java
88

99
# Use Java Message Service 2.0 API with Azure Service Bus Premium
1010

11-
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.
11+
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.
1212

1313
> [!NOTE]
1414
> Support for Java Message Service (JMS) 2.0 API is only available in the **premium tier**.>
1515
16-
## Pre-requisites
16+
## Prerequisites
1717

1818
### Get started with Service Bus
1919

@@ -35,16 +35,14 @@ To learn more about how to prepare your developer environment for Java on Azure,
3535

3636
## Downloading the Java Message Service (JMS) client library
3737

38-
To utilize all the features available in the premium tier, add the following library to the build path of the project.
39-
40-
[Azure-servicebus-jms](https://central.sonatype.com/artifact/com.microsoft.azure/azure-servicebus-jms/1.0.0)
38+
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.
4139

4240
> [!NOTE]
43-
> 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/).
41+
> 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/).
4442
4543
## Coding Java applications
4644

47-
Once the dependencies have been imported, the Java applications can be written in a JMS provider agnostic manner.
45+
Once the dependencies are imported, the Java applications can be written in a JMS provider agnostic manner.
4846

4947
### Connecting to Azure Service Bus using JMS
5048

@@ -85,7 +83,7 @@ To connect with Azure Service Bus using JMS clients, you need the **connection s
8583

8684
### Write the JMS application
8785

88-
Once the `Session` or `JMSContext` has been instantiated, your application can use the familiar JMS APIs to perform both management and data operations. Refer to the list of [supported JMS features](how-to-use-java-message-service-20.md#what-jms-features-are-supported) to see which APIs are supported. Here are some sample code snippets to get started with JMS -
86+
Once the `Session` or `JMSContext` is instantiated, your application can use the familiar JMS APIs to perform both management and data operations. Refer to the list of [supported JMS features](how-to-use-java-message-service-20.md#what-jms-features-are-supported) to see which APIs are supported. Here are some sample code snippets to get started with JMS -
8987

9088
#### Sending messages to a queue and topic
9189

@@ -137,13 +135,9 @@ This guide showcased how Java client applications using Java Message Service (JM
137135

138136
You can also use Service Bus AMQP 1.0 from other languages, including .NET, C, Python, and PHP. Components built using these different languages can exchange messages reliably and at full fidelity using the AMQP 1.0 support in Service Bus.
139137

140-
## Next steps
138+
## Related content
139+
140+
- [Use JMS in Spring to access Azure Service Bus](/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus)
141+
- [Use Azure Service Bus with JMS](/azure/developer/java/spring-framework/spring-jms-support)
142+
141143

142-
For more information on Azure Service Bus and details about Java Message Service (JMS) entities, check out the links below -
143-
* [Service Bus - Queues, Topics, and Subscriptions](service-bus-queues-topics-subscriptions.md)
144-
* [Service Bus - Java Message Service entities](service-bus-queues-topics-subscriptions.md#java-message-service-jms-20-entities)
145-
* [AMQP 1.0 support in Azure Service Bus](service-bus-amqp-overview.md)
146-
* [Service Bus AMQP 1.0 Developer's Guide](service-bus-amqp-dotnet.md)
147-
* [Get started with Service Bus queues](service-bus-dotnet-get-started-with-queues.md)
148-
* [Java Message Service API(external Oracle doc)](https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html)
149-
* [Learn how to migrate from ActiveMQ to Service Bus](migrate-jms-activemq-to-servicebus.md)

articles/service-bus-messaging/service-bus-prefetch.md

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ ms.devlang: csharp
88
---
99

1010
# Prefetch Azure Service Bus messages
11-
When you enable the **Prefetch** feature for any of the official Service Bus clients, the receiver acquires more messages than what the application initially asked for, up to the specified prefetch count. As messages are returned to the application, the client acquires more messages in the background, to fill the prefetch buffer.
11+
The Prefetch feature fetches messages in the background into a local prefetch buffer up to the prefetch count. Messages are served from the buffer. As it happens, space is freed up in the buffer, and the receiver will prefetch more in the background.
1212

13-
## Enable Prefetch
14-
To enable the Prefetch feature, set the prefetch count of the queue or subscription client to a number greater than zero. Setting the value to zero turns off prefetch.
13+
To enable the Prefetch feature, set the prefetch count of the queue or subscription client to a number greater than zero. Setting the value to zero turns off prefetch. If there are messages in the prefetch buffer after the feature is turned off, the application receives those messages from the buffer first, and then goes to the service.
1514

1615
# [.NET](#tab/dotnet)
1716
Set the prefetch count property on the [ServiceBusReceiverOptions](/dotnet/api/azure.messaging.servicebus.servicebusreceiveroptions.prefetchcount) and [ServiceBusProcessorOptions](/dotnet/api/azure.messaging.servicebus.servicebusprocessoroptions.prefetchcount) objects.
@@ -35,28 +34,14 @@ Prefetch speeds up the message flow by having a message readily available for lo
3534

3635
When you use the [receive and delete](message-transfers-locks-settlement.md#receiveanddelete) mode, all messages that are acquired into the prefetch buffer are no longer available in the queue. The messages stay only in the in-memory prefetch buffer until they're received into the application. If the application ends before the messages are received into the application, those messages are irrecoverable (lost).
3736

38-
When you use the [peek lock](message-transfers-locks-settlement.md#peeklock) receive mode, messages fetched into the prefetch buffer are acquired into the buffer in a locked state. They have the timeout clock for the lock ticking. If the prefetch buffer is large, and processing takes so long that message locks expire while staying in the prefetch buffer or even while the application is processing the message, there might be some confusing events for the application to handle. The application might acquire a message with an expired or imminently expiring lock. If so, the application might process the message, but then find that it can't complete the message because of a lock expiration. The application can check the `LockedUntilUtc` property (which is subject to clock skew between the broker and local machine clock).
37+
When you use the [peek lock](message-transfers-locks-settlement.md#peeklock) receive mode, messages fetched into the prefetch buffer are acquired into the buffer in a locked state. The lock timer starts from the moment the message is prefetched into the buffer. If the prefetch buffer is large, and processing takes so long that message locks expire while staying in the prefetch buffer or even while the application is processing the message, there might be some confusing events for the application to handle. The application might acquire a message with an expired or imminently expiring lock. If so, the application might process the message, but then find that it can't complete the message because of a lock expiration. The application can check the `LockedUntilUtc` property, but keep in mind that there's clock skew between the broker and local machine clock.
3938

40-
If the message lock has expired, the application must ignore the message, and shouldn't make any API call on the message. If the message isn't expired but expiration is imminent, the lock can be renewed and extended by another default lock period. If the lock silently expires in the prefetch buffer, the message is treated as abandoned and is again made available for retrieval from the queue. It might cause the message to be fetched into the prefetch buffer and placed at the end. If the prefetch buffer can't usually be worked through during the message expiration, messages are repeatedly prefetched but never effectively delivered in a usable (validly locked) state, and are eventually moved to the dead-letter queue once the maximum delivery count is exceeded.
39+
If the lock silently expires in the prefetch buffer, the message is treated as abandoned and is again made available for retrieval from the queue. Then the message will be fetched again into the prefetch buffer and placed at the end If the prefetch buffer can't usually be worked through during the message expiration, messages are repeatedly prefetched but never effectively delivered in a usable (validly locked) state, and are eventually moved to the dead-letter queue once the maximum delivery count is exceeded.
4140

42-
If an application explicitly abandons a message, the message may again be available for retrieval from the queue. When the prefetch is enabled, the message is fetched into the prefetch buffer again and placed at the end. As the messages from the prefetch buffer are drained in the first-in first-out (FIFO) order, the application may receive messages out of order. For example, the application may receive a message with ID 2 and then a message with ID 1 (that was abandoned earlier) from the buffer.
41+
If an application explicitly abandons a message, the message might again be available for retrieval from the queue. When the prefetch is enabled, the message is fetched into the prefetch buffer again and placed at the end. As the messages from the prefetch buffer are drained in the first-in first-out (FIFO) order, the application might receive messages out of order. For example, the application might receive a message with ID 2 and then a message with ID 1 (that was abandoned earlier) from the buffer.
4342

4443
If you need a high degree of reliability for message processing, and processing takes significant work and time, we recommend that you use the Prefetch feature conservatively, or not at all. If you need high throughput and message processing is commonly cheap, prefetch yields significant throughput benefits.
4544

4645
The maximum prefetch count and the lock duration configured on the queue or subscription need to be balanced such that the lock timeout at least exceeds the cumulative expected message processing time for the maximum size of the prefetch buffer, plus one message. At the same time, the lock timeout shouldn't be so long that messages can exceed their maximum time to live when they're accidentally dropped, and so requiring their lock to expire before being redelivered.
4746

48-
## Next steps
49-
50-
Try the samples in the language of your choice to explore Azure Service Bus features.
51-
52-
- [Azure Service Bus client library samples for .NET (latest)](/samples/azure/azure-sdk-for-net/azuremessagingservicebus-samples/)
53-
- [Azure Service Bus client library samples for Java (latest)](/samples/azure/azure-sdk-for-java/servicebus-samples/)
54-
- [Azure Service Bus client library samples for Python](/samples/azure/azure-sdk-for-python/servicebus-samples/)
55-
- [Azure Service Bus client library samples for JavaScript](/samples/azure/azure-sdk-for-js/service-bus-javascript/)
56-
- [Azure Service Bus client library samples for TypeScript](/samples/azure/azure-sdk-for-js/service-bus-typescript/)
57-
58-
Samples for the older .NET and Java client libraries:
59-
- [Azure Service Bus client library samples for .NET (legacy)](https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/Microsoft.Azure.ServiceBus/) - See the **Prefetch** sample.
60-
- [Azure Service Bus client library samples for Java (legacy)](https://github.com/Azure/azure-service-bus/tree/master/samples/Java/azure-servicebus) - See the **Prefetch** sample.
61-
6247
[!INCLUDE [service-bus-track-0-and-1-sdk-support-retirement](../../includes/service-bus-track-0-and-1-sdk-support-retirement.md)]

0 commit comments

Comments
 (0)