public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<BasicPublishBody> evt) throws AMQException
{
AMQProtocolSession session = stateManager.getProtocolSession();
final BasicPublishBody body = evt.getMethod();
if (_log.isDebugEnabled())
{
_log.debug("Publish received on channel " + evt.getChannelId());
}
// TODO: check the delivery tag field details - is it unique across the broker or per subscriber?
if (body.exchange == null)
{
body.exchange = ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
}
else
{
body.exchange = body.exchange.intern();
}
VirtualHost vHost = session.getVirtualHost();
Exchange e = vHost.getExchangeRegistry().getExchange(body.exchange);
// if the exchange does not exist we raise a channel exception
if (e == null)
{
throw body.getChannelException(AMQConstant.NOT_FOUND, "Unknown exchange name");
}
else
{
// The partially populated BasicDeliver frame plus the received route body
// is stored in the channel. Once the final body frame has been received
// it is routed to the exchange.
AMQChannel channel = session.getChannel(evt.getChannelId());
if (channel == null)
{
throw body.getChannelNotFoundException(evt.getChannelId());
}
if(body.routingKey != null)
{
body.routingKey = body.routingKey.intern();