Commit c2316645 authored by afreyssin's avatar afreyssin

Moves code handling correlationIDAsBytes in shared message.

parent ff19f44a
...@@ -532,15 +532,10 @@ public class Message implements javax.jms.Message { ...@@ -532,15 +532,10 @@ public class Message implements javax.jms.Message {
* *
* @return the correlation ID for the message as an array of bytes. * @return the correlation ID for the message as an array of bytes.
* *
* @exception MessageFormatException In case of a problem while retrieving * @exception JMSException Actually never thrown.
* the field.
*/ */
public final byte[] getJMSCorrelationIDAsBytes() throws JMSException { public final byte[] getJMSCorrelationIDAsBytes() throws JMSException {
try { return momMsg.getJMSCorrelationIDAsBytes();
return ConversionHelper.toBytes(momMsg.correlationId);
} catch (MessageValueException mE) {
throw new MessageFormatException(mE.getMessage());
}
} }
/** /**
...@@ -553,8 +548,8 @@ public class Message implements javax.jms.Message { ...@@ -553,8 +548,8 @@ public class Message implements javax.jms.Message {
* *
* @exception JMSException Actually never thrown. * @exception JMSException Actually never thrown.
*/ */
public final void setJMSCorrelationIDAsBytes(byte[] correlationID) { public final void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException {
momMsg.correlationId = ConversionHelper.toString(correlationID); momMsg.setJMSCorrelationIDAsBytes(correlationID);
} }
/** /**
......
...@@ -264,6 +264,29 @@ public final class Message implements Cloneable, Serializable, Streamable, Encod ...@@ -264,6 +264,29 @@ public final class Message implements Cloneable, Serializable, Streamable, Encod
/** The correlation identifier field. */ /** The correlation identifier field. */
public transient String correlationId = null; public transient String correlationId = null;
/**
* Gets the correlation ID as an array of bytes for the message.
*
* @return the correlation ID for the message as an array of bytes.
*/
public final byte[] getJMSCorrelationIDAsBytes() {
if (correlationId != null)
return correlationId.getBytes();
return null;
}
/**
* Sets the correlation ID as an array of bytes for the message.
*
* @param correlationID the message ID value as an array of bytes.
*/
public final void setJMSCorrelationIDAsBytes(byte[] correlationID) {
if (correlationID != null)
this.correlationId = new String(correlationID);
else
this.correlationId = null;
}
/** The number of delivery attempts for this message. */ /** The number of delivery attempts for this message. */
public transient int deliveryCount = 0; public transient int deliveryCount = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment