[jboss-jira] [JBoss JIRA] Created: (JBMESSAGING-1617) JBoss should rely on JMSCorrelationID as String as per JMS1.1 spec and handle java.lang.UnsupportedOperationException

Alexandre MOOTASSEM (JIRA) jira-events at lists.jboss.org
Tue May 5 10:08:03 EDT 2009


JBoss should rely on JMSCorrelationID as String as per JMS1.1 spec and handle java.lang.UnsupportedOperationException
---------------------------------------------------------------------------------------------------------------------

                 Key: JBMESSAGING-1617
                 URL: https://jira.jboss.org/jira/browse/JBMESSAGING-1617
             Project: JBoss Messaging
          Issue Type: Support Patch
          Components: JMS Facade, Messaging Core
    Affects Versions: 1.4.3.GA, 1.4.2.GA.SP1, 1.4.2.GA, 1.4.1.GA, 2.0.0 Alpha, 1.4.1.CR1, 1.4.1.beta1, 1.4.0.SP3.CP07, 1.4.0.SP3.CP06, 1.4.0.SP3.CP05,  1.4.0.SP3.CP04, 1.4.0.SP3_CP03
         Environment: - Linux 2.6.27-11-generic x86_64
- Linux 2.6.9-78.EL x86_64
            Reporter: Alexandre MOOTASSEM
            Assignee: Tim Fox


JavaTM Message Service Specification Version 1.1 :

" 3.4.5 JMSCorrelationID

A client can use the JMSCorrelationID header field to link one message with another. A typical use is to link a response message with its request message.

JMSCorrelationID can hold one of the following:

• A provider-specific message ID

• An application-specific String

• A provider-native byte[] value

Since each message sent by a JMS provider is assigned a message ID value, it is convenient to link messages via message ID. All message ID values must start with the 'ID:' prefix.

In some cases, an application (made up of several clients) needs to use an application-specific value for linking messages. For instance, an application may use JMSCorrelationID to hold a value referencing some external information. Application-specified values must not start with the 'ID:' prefix; this is reserved for provider-generated message ID values.

If a provider supports the native concept of correlation ID, a JMS client may need to assign specific JMSCorrelationID values to match those expected by non-JMS clients. A byte[] value is used for this purpose. JMS providers without native correlation ID values are not required to support byte[] values*. The use of a byte[] value for JMSCorrelationID is non-portable.

* Their implementation of setJMSCorrelationIDAsBytes() and getJMSCorrelationIDAsBytes() may throw java.lang.UnsupportedOperationException"

So, the following constructor should rely on the application-specific String as JMSCorrelationID and handle UnsupportedOperationException :

/**
    * A copy constructor for non-JBoss Messaging JMS messages.
    */   
   public JBossMessage(Message foreign, long messageID) throws JMSException
   {
      super(messageID);

      setJMSTimestamp(foreign.getJMSTimestamp());

      try
      {
         byte[] corrIDBytes = foreign.getJMSCorrelationIDAsBytes();
         setJMSCorrelationIDAsBytes(corrIDBytes);
      }
      catch(JMSException e)
      {
         // specified as String
         String corrIDString = foreign.getJMSCorrelationID();
         if (corrIDString != null)
         {
            setJMSCorrelationID(corrIDString);
         }
      }
      
      setJMSReplyTo(foreign.getJMSReplyTo());
      setJMSDestination(foreign.getJMSDestination());
      setJMSDeliveryMode(foreign.getJMSDeliveryMode());
      setJMSExpiration(foreign.getJMSExpiration());
      setJMSPriority(foreign.getJMSPriority());
      setJMSType(foreign.getJMSType());

      for (Enumeration props = foreign.getPropertyNames(); props.hasMoreElements(); )
      {
         String name = (String)props.nextElement();
         
         Object prop = foreign.getObjectProperty(name);

         this.setObjectProperty(name, prop);                       
      }
   }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the jboss-jira mailing list