void declareDestination(AMQDestination destination)
{
if(getSession().isDeclareExchanges())
{
final MethodRegistry methodRegistry = getSession().getMethodRegistry();
ExchangeDeclareBody body =
methodRegistry.createExchangeDeclareBody(getSession().getTicket(),
destination.getExchangeName(),
destination.getExchangeClass(),
destination.getExchangeName().toString().startsWith("amq."),
destination.isExchangeDurable(),
destination.isExchangeAutoDelete(),
destination.isExchangeInternal(),
true,
null);
AMQFrame declare = body.generateFrame(getChannelId());
getConnection().getProtocolHandler().writeFrame(declare);
}
}