ARTEMIS-629 Preserve the correlation ID type during conversions

When converted to a core message type the original type of the
CorrelationId in the AMQP message is lost, we must encode the type to
prevent the loss of the original type as this value is meant to be
immutable.
This commit is contained in:
Timothy Bish 2016-07-12 18:18:26 -04:00 committed by Andy Taylor
parent 1893d773a4
commit 688eac50ea
2 changed files with 9 additions and 2 deletions

View File

@ -215,7 +215,7 @@ public abstract class InboundTransformer {
jms.setJMSReplyTo(vendor.createDestination(properties.getReplyTo()));
}
if (properties.getCorrelationId() != null) {
jms.setJMSCorrelationID(properties.getCorrelationId().toString());
jms.setJMSCorrelationID(AMQPMessageIdHelper.INSTANCE.toBaseMessageIdString(properties.getCorrelationId()));
}
if (properties.getContentType() != null) {
jms.setStringProperty(prefixVendor + "ContentType", properties.getContentType().toString());

View File

@ -176,7 +176,14 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
maMap.put(LEGACY_JMS_REPLY_TO_TYPE_MSG_ANNOTATION, destinationAttributes(msg.getJMSReplyTo()));
}
if (msg.getJMSCorrelationID() != null) {
props.setCorrelationId(msg.getJMSCorrelationID());
String correlationId = msg.getJMSCorrelationID();
try {
props.setCorrelationId(AMQPMessageIdHelper.INSTANCE.toIdObject(correlationId));
}
catch (ActiveMQAMQPIllegalStateException e) {
props.setCorrelationId(correlationId);
}
}
if (msg.getJMSExpiration() != 0) {
long ttl = msg.getJMSExpiration() - System.currentTimeMillis();