[jboss-jira] [JBoss JIRA] Closed: (JBMESSAGING-1617) JBM does not handle java.lang.UnsupportedOperationException thrown from getCorrelationIDBytes() when copying a foreign message.

Howard Gao (JIRA) jira-events at lists.jboss.org
Wed Jul 8 04:47:03 EDT 2009


     [ https://jira.jboss.org/jira/browse/JBMESSAGING-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard Gao closed JBMESSAGING-1617.
-----------------------------------



introduced a system property 'support.bytesId'. If set to false, JBossMessage will not use the bytes ID of the foreign message. Otherwise it stays as before. Document 2.3.1 has added for this.

> JBM does not handle java.lang.UnsupportedOperationException thrown from getCorrelationIDBytes() when copying a foreign message.
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 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.0.SP3_CP03,  1.4.0.SP3.CP04, 1.4.0.SP3.CP05, 1.4.0.SP3.CP06, 1.4.0.SP3.CP07, 1.4.1.beta1, 1.4.1.CR1, 2.0.0 Alpha, 1.4.1.GA, 1.4.2.GA, 1.4.2.GA.SP1, 1.4.3.GA
>         Environment: - Linux 2.6.27-11-generic x86_64
> - Linux 2.6.9-78.EL x86_64
>            Reporter: Alexandre MOOTASSEM
>            Assignee: Howard Gao
>             Fix For: 1.4.0.SP3.CP09, 1.4.5.GA
>
>
> Some providers can throw UnsupportedOperationException from getCorrelationIDBytes(). This is called in the foreign message constructor of a JBM message. Currently JBM will fail to copy the message since the exception is not handled.
> 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