@Override
public void exchangeBound(Session session, ExchangeBound method)
{
ExchangeBoundResult result = new ExchangeBoundResult();
Exchange exchange;
AMQQueue queue;
if(method.hasExchange())
{
exchange = getExchange(session, method.getExchange());
if(exchange == null)
{
result.setExchangeNotFound(true);
}
}
else
{
exchange = getExchangeRegistry(session).getDefaultExchange();
}
if(method.hasQueue())
{
queue = getQueue(session, method.getQueue());
if(queue == null)
{
result.setQueueNotFound(true);
}
if(exchange != null && queue != null)
{
boolean queueMatched = exchange.isBound(queue);
result.setQueueNotMatched(!queueMatched);
if(method.hasBindingKey())
{
if(method.hasArguments())
{
FieldTable args = FieldTable.convertToFieldTable(method.getArguments());
result.setArgsNotMatched(!exchange.isBound(new AMQShortString(method.getBindingKey()), args, queue));
}
if(queueMatched)
{
result.setKeyNotMatched(!exchange.isBound(method.getBindingKey(), queue));
}
else
{
result.setKeyNotMatched(!exchange.isBound(method.getBindingKey()));
}
}
else if (method.hasArguments())
{
// TODO
}
result.setQueueNotMatched(!exchange.isBound(queue));
}
else if(exchange != null && method.hasBindingKey())
{
if(method.hasArguments())
{
// TODO
}
result.setKeyNotMatched(!exchange.isBound(method.getBindingKey()));
}
}
else if(exchange != null && method.hasBindingKey())
{
if(method.hasArguments())
{
// TODO
}
result.setKeyNotMatched(!exchange.isBound(method.getBindingKey()));
}
session.executionResult((int) method.getId(), result);