Message inMessage = new MessageImpl();
synchronized (inMessage) {
correlationMap.put(correlationId, inMessage);
jmsTemplate.send(jmsConfig.getTargetDestination(), messageCreator);
try {
inMessage.wait(jmsTemplate.getReceiveTimeout());
} catch (InterruptedException e) {
correlationMap.remove(correlationId);
throw new RuntimeException(e);
}
correlationMap.remove(correlationId);