JMSTimestamp Example

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

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

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

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