try
{
AMQDestination dest = (AMQDestination)AMQDestination.createDestination("ADDR:" + addr);
if (isQueue)
{
dest.setQueueName(new AMQShortString(routingKey));
dest.setRoutingKey(new AMQShortString(routingKey));
dest.setExchangeName(new AMQShortString(""));
}
else
{
dest.setRoutingKey(new AMQShortString(routingKey));
dest.setExchangeName(new AMQShortString(exchange));
}
return dest;
}
catch(Exception e)
{
// An exception is only thrown here if the address syntax is invalid.
// Logging the exception, but not throwing as this is only important to Qpid developers.
// An exception here means a bug in the code.
_logger.error("Exception when constructing an address string from the ReplyTo struct");
// falling back to the old way of doing it to ensure the application continues.
return generateDestination(new AMQShortString(exchange), new AMQShortString(routingKey));
}
}