In this post under JMS, I will explain about JMSTimestamp with an example Note: I will be using JMS 2.0 api for this and future examples. JMSTimestamp is a header field which is only set by JMS Provider and contains a long value in milliseconds that represents the time when the message was handed over…… Continue reading JMSTimestamp Example
Category: JMS 2.0
JMSMessageID example
In this post under JMS, I will explain about JMSMessageID with an example JMSMessageID is a header field which is only set by JMS Provider and contains a string value that uniquely identifies a message. JMSMessageID is set by the provider when the JMSProducer calls the send method. Before calling the JMSProducer’s send method, the…… Continue reading JMSMessageID example
Sending JMS messages in a Transaction
In this post under JMS, I will explain how to send JMS messages in a Transaction. If you are running your code in Java SE environment or Java EE application client side code. We create a transacted session by calling the below method on ConnectionFactory class and passing “JMSContext.SESSION_TRANSACTED” as session mode. public JMSContext createContext(int…… Continue reading Sending JMS messages in a Transaction
Setting JMS message priority
In this post under JMS, I will show with example how to set the priority of JMS messages before sending them. Note: I will be using JMS 2.0 api for this and future examples. JMS defines a ten level priority with 0 as the lowest priority and 9 as the highest. 0-4 is a normal…… Continue reading Setting JMS message priority
QueueBrowser Example
In this post under JMS, I will explain with an example what is QueueBrowser and how to use it. Note: I will be using JMS 2.0 api for this and future examples. The name “QueueBrowser” implies two things 1) It can be used only for queue that means in point to point messaging model. 2)…… Continue reading QueueBrowser Example
Receiving JMS messages asynchronously
In this post under JMS I will explain how to receive messages asynchronously. Note: I will be using JMS 2.0 api for this and future examples. In all my previous post’s examples I have used “receive” method under “JSMConsumer” class to receive messages synchronously. To receive messages asynchronously we will take the help of “javax.jms.MessageListener”…… Continue reading Receiving JMS messages asynchronously
Sending JMS messages asynchronously
In this post, I will explain how to send JMS messages asynchronously. Note: I will be using JMS 2.0 api for this and future examples. When messages are sent asynchronously, the producer of the message won’t wait for acknowledgement from the provider. In this case, the producer uses callback approach so that he can be…… Continue reading Sending JMS messages asynchronously
Creating a temporary queue or topic
In this post under JMS I will explain how to create temporary queue or topic. Note: I will be using JMS 2.0 api for this and future examples Non temporary queue or topics are created by administrator and we developers connect to those topic or queue using the below method Destination destination = (Destination)initialContext.lookup(“MyQueue”); Whereas…… Continue reading Creating a temporary queue or topic
Sending and Receiving Map data as JMS message payload
In this post under JMS I will explain how to send and receive Java Map data as JMS Message payload. Note: I will be using JMS 2.0 api for this and future examples Below is the complete main class code Main Class 1 package package3; 2 3 import java.util.Properties; 4 5 import javax.jms.ConnectionFactory; 6 import…… Continue reading Sending and Receiving Map data as JMS message payload
Setting/Accessing properties of JMS messages
In this post, I will explain how to set and access properties of a JMS messaages. Note: I will be using JMS 2.0 api for this and future examples Below is the complete Main code. Main Class 1 package package2; 2 3 import java.util.Properties; 4 5 import javax.jms.ConnectionFactory; 6 import javax.jms.Destination; 7 import javax.jms.JMSException; 8…… Continue reading Setting/Accessing properties of JMS messages