Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/brokenlinks-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"pattern": "/solacevmr:8080/"
}
],
"aliveStatusCodes": [400, 429, 200, 0, 403]
"aliveStatusCodes": [400, 429, 200, 0, 403, 503]
}
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ module.exports = {
},
{
pathname: "/jms",
crumbLabel: "JMS",
crumbLabel: "Jakarta Messaging",
},
{
pathname: "/tanzu",
Expand Down
10 changes: 5 additions & 5 deletions src/pages/tutorials/jms/confirmed-delivery.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ links:

This tutorial builds on the basic concepts introduced in [Persistence with Queues](../persistence-with-queues/) tutorial and will show you how to properly process publisher acknowledgements. Once an acknowledgement for a message has been received and processed, you have confirmed your persistent messages have been properly accepted by Solace messaging and therefore can be guaranteed of no message loss.

## Persistent Publishing with JMS version 1.1
## Persistent Publishing with Jakarta Messaging

In the JMS version 1.1, when sending PERSISTENT messages, the JMS MessageProducer must not return from the blocking send() method until the message is fully acknowledged by Solace messaging. This behavior is mandated by the specification. Therefore applications sending persistent messages using JMS version 1.1 are guaranteed that the messages is accepted by Solace messaging by the time the MessageProducer.send() returns. No extra publisher acknowledgement handling is required or possible using the JMS API.
In Jakarta Messaging (and its JMS predecessors), when sending PERSISTENT messages, the MessageProducer must not return from the blocking send() method until the message is fully acknowledged by Solace messaging. This behavior is mandated by the specification. Therefore applications sending persistent messages using Jakarta Messaging are guaranteed that the message is accepted by Solace messaging by the time the MessageProducer.send() returns. No extra publisher acknowledgement handling is required or possible using the Jakarta Messaging API.
Comment thread
HariRangarajan-Solace marked this conversation as resolved.

This restriction of the JMS 1.1 specification does mean that PERSISTENT message producers are forced to block on each message until it is fully guaranteed by the messaging system. This can lead to performance bottlenecks on publish. Applications can work around this by using JMS Session based transactions and committing the transaction only after several messages are sent to the messaging system.
This restriction of the specification does mean that PERSISTENT message producers are forced to block on each message until it is fully guaranteed by the messaging system. This can lead to performance bottlenecks on publish. Applications can work around this by using Jakarta Messaging Session based transactions and committing the transaction only after several messages are sent to the messaging system.

Refer to the [JMS specification](http://download.oracle.com/otndocs/jcp/7195-jms-1.1-fr-spec-oth-JSpec/) for further details on this subject.
Refer to the [Jakarta Messaging 3.1 specification](https://jakarta.ee/specifications/messaging/3.1/) for further details on this subject.

## Summarizing

For a JMS version 1.1 applications there is nothing further they must do to confirm message delivery with Solace messaging. This is handled by the API by making the send call blocking.
For Jakarta Messaging applications there is nothing further they must do to confirm message delivery with Solace messaging. This is handled by the API by making the send call blocking.
44 changes: 22 additions & 22 deletions src/pages/tutorials/jms/persistence-with-queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ summary: Learn how to set up persistence for guaranteed delivery.
icon: I_dev_Persistent.svg
links:
- label: QueueProducer.java
link: /blob/master/src/main/java/com/solace/samples/QueueProducer.java
link: /blob/master/src/main/java/com/solace/samples/jakarta/messaging/QueueProducer.java
- label: QueueConsumer.java
link: /blob/master/src/main/java/com/solace/samples/QueueConsumer.java
link: /blob/master/src/main/java/com/solace/samples/jakarta/messaging/QueueConsumer.java
- label: feedback
link: https://github.com/SolaceDev/solace-dev-tutorials/blob/master/src/pages/tutorials/jms/persistence-with-queues.md
---
Expand All @@ -34,26 +34,26 @@ The goal of this tutorial is to understand the following:
2. How to send a persistent message to a Solace queue
3. How to bind to this queue and receive a persistent message

## Java Messaging Service (JMS) Introduction
## Jakarta Messaging (JMS) Introduction

JMS is a standard API for sending and receiving messages. As such, in addition to information provided on the Solace developer portal, you may also look at some external sources for more details about JMS. The following are good places to start
Jakarta Messaging (the successor to Java Message Service — JMS — under the Jakarta EE project) is a standard API for sending and receiving messages. It uses the `jakarta.jms.*` namespace where earlier JMS versions used `javax.jms.*`. In addition to information provided on the Solace developer portal, you may also look at some external sources for more details. The following are good places to start:

1. [https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html](https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html)
2. [https://en.wikipedia.org/wiki/Java_Message_Service](https://en.wikipedia.org/wiki/Java_Message_Service)
3. [https://docs.oracle.com/javaee/7/tutorial/partmessaging.htm#GFIRP3](https://docs.oracle.com/javaee/7/tutorial/partmessaging.htm#GFIRP3)
1. [Jakarta Messaging 3.1 Specification](https://jakarta.ee/specifications/messaging/3.1/)
2. [Jakarta Messaging 3.1 API Javadoc](https://jakarta.ee/specifications/messaging/3.1/apidocs/jakarta.messaging/jakarta/jms/package-summary.html)
3. [https://en.wikipedia.org/wiki/Jakarta_Messaging](https://en.wikipedia.org/wiki/Jakarta_Messaging)

The oracle link points you to the JavaEE official tutorials which provide a good introduction to JMS. This getting started tutorial follows a similar path and shows you the Solace specifics that you need to do to get this working with Solace messaging.
The Jakarta EE links above provide the official specification and API reference. This getting started tutorial follows a similar path and shows you the Solace specifics that you need to do to get this working with Solace messaging.

`markdown:solaceMessaging-part1.md`
![Screenshot: Messaging Connectivity Information](../../../images/screenshots/connectivity-info.png)
`markdown:solaceMessaging-part2.md`
`markdown:solaceApi.md`

## JMS administered objects
## Jakarta Messaging administered objects

This tutorial will make use of two JMS administered objects:
This tutorial will make use of two Jakarta Messaging administered objects:

* A ConnectionFactory object – Used by JMS clients to successfully connect to a message broker like Solace messaging
* A ConnectionFactory object – Used by Jakarta Messaging clients to successfully connect to a message broker like Solace messaging
* A Queue Destination – Used for publishing and subscribing to messages. This example will use the queue `Q/tutorial`

As described in the [publish/subscribe tutorial](../publish-subscribe/) we will use the approach of programmatically creating the required objects.
Expand All @@ -62,15 +62,15 @@ As described in the [publish/subscribe tutorial](../publish-subscribe/) we will

A difference to the publish/subscribe tutorial is that here a physical endpoint resource – a durable queue, associated with the Queue Destination – needs to be created on Solace messaging, which will persist the messages until consumed.

We will use the Dynamic Durables feature, which enables the physical endpoint resource to be dynamically created without any additional steps, when the JMS Queue Destination is created programmatically. It is also possible to create resources administratively on the router using the Solace message router [Management Tools](https://docs.solace.com/#Management).
We will use the Dynamic Durables feature, which enables the physical endpoint resource to be dynamically created without any additional steps, when the Jakarta Messaging Queue Destination is created programmatically. It is also possible to create resources administratively on the router using the Solace message router [Management Tools](https://docs.solace.com/#Management).

To use Dynamic Durables, you need to connect the JMS Connection as outlined in the [publish/subscribe tutorial](../publish-subscribe/) with one additional property:
To use Dynamic Durables, you need to connect the Jakarta Messaging Connection as outlined in the [publish/subscribe tutorial](../publish-subscribe/) with one additional property:

```java
connectionFactory.setDynamicDurables(true);
```

Then we simply create a queue from the JMS `Session`. For other ways of obtaining a queue, for example using JNDI, refer to the [Solace JMS Documentation - Working with Destinations](https://docs.solace.com/Solace-JMS-API/Working-with-Destination.htm).
Then we simply create a queue from the Jakarta Messaging `Session`. For other ways of obtaining a queue, for example using JNDI, refer to the [Solace Jakarta Messaging Documentation - Working with Destinations](https://docs.solace.com/API/Solace-Jakarta-API/Working-with-Destination.htm).

```java
final String QUEUE_NAME = "Q/tutorial";
Expand All @@ -85,7 +85,7 @@ Now it is time to send a message to the queue.

![Diagram: Sending a Message to a Queue](../../../images/diagrams/sending-message-to-queue-300x160.png)

There is no difference in the actual method calls to the JMS `MessageProducer` when sending a PERSISTENT message as compared to a NON-PERSISTENT message shown in the publish/subscribe tutorial. The difference in the PERSISTENT message is that Solace messaging will acknowledge the message once it is successfully stored on the message router and the `MessageProducer.send()` call will not return until it has successfully received this acknowledgement. This means that in JMS, all calls to the `MessageProducer.send()` are blocking calls and they wait for message confirmation from Solace messaging before proceeding. This is outlined in the JMS 1.1 specification and Solace JMS adheres to this requirement.
There is no difference in the actual method calls to the Jakarta Messaging `MessageProducer` when sending a PERSISTENT message as compared to a NON-PERSISTENT message shown in the publish/subscribe tutorial. The difference in the PERSISTENT message is that Solace messaging will acknowledge the message once it is successfully stored on the message router and the `MessageProducer.send()` call will not return until it has successfully received this acknowledgement. This means that in Jakarta Messaging, all calls to the `MessageProducer.send()` are blocking calls and they wait for message confirmation from Solace messaging before proceeding. This is outlined in the Jakarta Messaging specification, and the Solace Jakarta Messaging API adheres to this requirement.

To send a message, you must still create a message. The difference from sending a NON-PERSISTENT message is that you must set the message delivery mode to PERSISTENT on send.

Expand All @@ -102,7 +102,7 @@ Now it is time to receive the messages sent to your queue.

![Diagram: Receiving a Message from a Queue](../../../images/diagrams/receiving-message-from-queue-300x160.png)

You still need a JMS `Connection` just as you did with the producer. With a connection, you then need to create a Session and bind to Solace messaging queue by creating a `MessageConsumer`. This is nearly identical to what was shown in the publish/subscribe tutorial. In this case, create a Session but use the Solace client acknowledgement mode. This allows the consumers to acknowledge each message individually without side-effects. You can learn more about acknowledgement modes in the Establishing Connections sections of [Solace JMS Documentation – Establishing Connections](https://docs.solace.com/Solace-JMS-API/Establishing-Connections.htm).
You still need a Jakarta Messaging `Connection` just as you did with the producer. With a connection, you then need to create a Session and bind to Solace messaging queue by creating a `MessageConsumer`. This is nearly identical to what was shown in the publish/subscribe tutorial. In this case, create a Session but use the Solace client acknowledgement mode. This allows the consumers to acknowledge each message individually without side-effects. You can learn more about acknowledgement modes in the Establishing Connections sections of [Solace Jakarta Messaging Documentation – Establishing Connections](https://docs.solace.com/API/Solace-Jakarta-API/Establishing-Connections.htm).

```java
Session session = connection.createSession(false, SupportedProperty.SOL_CLIENT_ACKNOWLEDGE));
Expand Down Expand Up @@ -135,19 +135,19 @@ messageConsumer.setMessageListener(new MessageListener() {

## Summarizing

The full source code for this example is available in [GitHub](https://github.com/SolaceSamples/solace-samples-jms). If you combine the example source code shown above results in the following source:
The full source code for this example is available in [GitHub](https://github.com/SolaceSamples/solace-samples-jms-jakarta). If you combine the example source code shown above results in the following source:

* [QueueProducer.java](https://github.com/SolaceSamples/solace-samples-jms/blob/master/src/main/java/com/solace/samples/QueueProducer.java)
* [QueueConsumer.java](https://github.com/SolaceSamples/solace-samples-jms/blob/master/src/main/java/com/solace/samples/QueueConsumer.java)
* [QueueProducer.java](https://github.com/SolaceSamples/solace-samples-jms-jakarta/blob/master/src/main/java/com/solace/samples/jakarta/messaging/QueueProducer.java)
* [QueueConsumer.java](https://github.com/SolaceSamples/solace-samples-jms-jakarta/blob/master/src/main/java/com/solace/samples/jakarta/messaging/QueueConsumer.java)


### Getting the Source

Clone the GitHub repository containing the Solace samples.

```
git clone https://github.com/SolaceSamples/solace-samples-jms
cd solace-samples-jms
git clone https://github.com/SolaceSamples/solace-samples-jms-jakarta
cd solace-samples-jms-jakarta
```

### Building
Expand All @@ -158,7 +158,7 @@ Building these examples is simple. You can simply build the project using Gradl
./gradlew assemble
```

This builds all of the JMS Getting Started Samples with OS specific launch scripts. The files are staged in the `build/staged` directory.
This builds all of the Jakarta Messaging Getting Started Samples with OS specific launch scripts. The files are staged in the `build/staged` directory.


### Running the Sample
Expand Down
Loading
Loading