public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<BasicGetBody> evt) throws AMQException
{
AMQProtocolSession session = stateManager.getProtocolSession();
BasicGetBody body = evt.getMethod();
final int channelId = evt.getChannelId();
VirtualHost vHost = session.getVirtualHost();
AMQChannel channel = session.getChannel(channelId);
if (channel == null)
{
throw body.getChannelNotFoundException(evt.getChannelId());
}
else
{
AMQQueue queue = body.queue == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.queue);
if (queue == null)
{
_log.info("No queue for '" + body.queue + "'");
if(body.queue!=null)
{
throw body.getConnectionException(AMQConstant.NOT_FOUND,
"No such queue, '" + body.queue + "'");
}
else
{
throw body.getConnectionException(AMQConstant.NOT_ALLOWED,
"No queue name provided, no default queue defined.");
}
}
else
{
if(!queue.performGet(session, channel, !body.noAck))
{
// TODO - set clusterId
session.writeFrame(BasicGetEmptyBody.createAMQFrame(channelId, body.getMajor(), body.getMinor(), null));
}
}
}
}