jms-spec
  1. jms-spec
  2. JMS_SPEC-124

Sending a foreign message using a provider which does not support setJMSCorrelationIDAsBytes

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      It is optional whether a JMS provider supports the method setJMSCorrelationIDAsBytes on Message. This method is permitted to throw a java.lang.UnsupportedOperationException if the provider does not support this feature.

      However there is an obscure case (which applies equally to JMS 1.1 and JMS 2.0) where the allowed behaviour is not specified. This is when a JMS provider is being used to send a message whose implementation is not its own (which JMS says must be allowed).

      Imagine an application that receives a message from a JMS provider which supports native correlation ID values, and then sends the same message to a JMS provider which does not support them.

      // receive message from JMS provider which supports native correlation ID values
      MessageConsumer consumer = ....
      Message message = consumer.receive(); 
      
      // now call setJMSCorrelationIDAsBytes on the received message
      // this will work as the provider supports native correlation ID values
      message.setJMSCorrelationIDAsBytes(bytes);  
      
      // now send this message using a JMS provider which does NOT support native correlation ID values
      // should this throw a UnsupportedOperationException?
      MessageProducer producer = ...
      producer.send(message);  
      

      There are two options here. Since the second JMS provider does not support native correlation ID values it must either throw a UnsupportedOperationException or simply ignore the value that was set.

      The spec should be clarified to define the allowed behaviour.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Nigel Deakin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: