private void addMessageIDInHeader(final Message msg) throws Exception { // We concatenate the old message id as a header in the message // This allows the target to then use this as the JMSCorrelationID of any response message // thus enabling a distributed request-response pattern. // Each bridge (if there are more than one) in the chain can concatenate the message id // So in the case of multiple bridges having routed the message this can be used in a multi-hop // distributed request/response if (JMSBridgeImpl.trace) { HornetQJMSServerLogger.LOGGER.trace("Adding old message id in Message header"); } JMSBridgeImpl.copyProperties(msg); String val = null; val = msg.getStringProperty(HornetQJMSConstants.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST); if (val == null) { val = msg.getJMSMessageID(); } else { StringBuffer sb = new StringBuffer(val); sb.append(",").append(msg.getJMSMessageID()); val = sb.toString(); } msg.setStringProperty(HornetQJMSConstants.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST, val); }