AMQShortString consumerTag = channel.subscribeToQueue(consumerTagName, queue, !body.getNoAck(),
body.getArguments(), body.getNoLocal(), body.getExclusive());
if (!body.getNowait())
{
MethodRegistry methodRegistry = protocolConnection.getMethodRegistry();
AMQMethodBody responseBody = methodRegistry.createBasicConsumeOkBody(consumerTag);
protocolConnection.writeFrame(responseBody.generateFrame(channelId));
}
}
else
{
AMQShortString msg = new AMQShortString("Non-unique consumer tag, '" + body.getConsumerTag() + "'");
MethodRegistry methodRegistry = protocolConnection.getMethodRegistry();
AMQMethodBody responseBody = methodRegistry.createConnectionCloseBody(AMQConstant.NOT_ALLOWED.getCode(), // replyCode
msg, // replytext
body.getClazz(),
body.getMethod());
protocolConnection.writeFrame(responseBody.generateFrame(0));
}
}
catch (org.apache.qpid.AMQInvalidArgumentException ise)
{
_logger.debug("Closing connection due to invalid selector");
MethodRegistry methodRegistry = protocolConnection.getMethodRegistry();
AMQMethodBody responseBody = methodRegistry.createChannelCloseBody(AMQConstant.ARGUMENT_INVALID.getCode(),
new AMQShortString(ise.getMessage()),
body.getClazz(),
body.getMethod());
protocolConnection.writeFrame(responseBody.generateFrame(channelId));
}
catch (AMQQueue.ExistingExclusiveSubscription e)
{