Sunday 5 August 2018

JMS defined properties

All the JMS defined properties are prefixed by "JMSX".

Below tables summarizes all the jms properties, who will set the properties,and  is the support for the property is mandatory or optional by the JMX vendor.

Name
Type
Optional or mandatory
Set By
Use
JMSXUserID
String
Optional
Provider on Send
The identity of the user sending the message
JMSXAppID
String
Optional
Provider on Send
The identity of the application sending the message
JMSXDeliveryCount
int
Mandatory
Provider on Receive
The number of message delivery attempts.
JMSXGroupID
String
Optional
Client
The identity of the message group this message is part of
JMSXGroupSeq
int
Optional
Client
The sequence number of this message within the group; the first message is 1, the second 2,...
JMSXProducerTXID
String
Optional
Provider on Send
The transaction identifier of the transaction within which this message was produced
JMSXConsumerTXID
String
Optional
Provider on Receive
The transaction identifier of the transaction within which this message was consumed
JMSXRcvTimestamp
long
Optional
Provider on Receive
The time JMS delivered the message to the consumer
JMSXState
int
Optional
Provider
Assume there exists a message warehouse that contains a separate copy of each message sent to each consumer and that these copies exist from the time the original message was sent.
Each copy’s state is one of: 1(waiting), 2(ready), 3(expired) or 4(retained)
Since state is of no interest to producers and consumers it is not provided to either. It is only of relevance to messages looked up in a warehouse and JMS provides no API for this.

How to get all the JMSX properties supported by a connection?
Use the API 'ConnectionMetaData.getJMSXPropertyNames()' to get all the supported JMS defined properties.

For example, ActiveMQ provides 'ActiveMQConnectionMetaData' class to get all the supported jms properties.

Test.java

package com.sample.app;

import java.util.Enumeration;

import javax.jms.JMSException;

import org.apache.activemq.ActiveMQConnectionMetaData;

public class Test {

 public static void main(String args[]) throws JMSException {
  Enumeration<String> jmsxProperties = ActiveMQConnectionMetaData.INSTANCE.getJMSXPropertyNames();

  while (jmsxProperties.hasMoreElements()) {
   String property = jmsxProperties.nextElement();

   System.out.println("Property : " + property);
  }

 }
}


Output
Property : JMSXUserID
Property : JMSXGroupID
Property : JMSXGroupSeq
Property : JMSXDeliveryCount
Property : JMSXProducerTXID




Previous                                                 Next                                                 Home

No comments:

Post a Comment