protected void DispatchMessage(MessageDispatch dispatch)
{
lock(dispatchers.SyncRoot)
{
if(dispatchers.Contains(dispatch.ConsumerId))
{
IDispatcher dispatcher = (IDispatcher) dispatchers[dispatch.ConsumerId];
// Can be null when a consumer has sent a MessagePull and there was
// no available message at the broker to dispatch or when signalled
// that the end of a Queue browse has been reached.
if(dispatch.Message != null)
{
dispatch.Message.ReadOnlyBody = true;
dispatch.Message.ReadOnlyProperties = true;
dispatch.Message.RedeliveryCounter = dispatch.RedeliveryCounter;
}
dispatcher.Dispatch(dispatch);
return;
}
}
Tracer.Error("No such consumer active: " + dispatch.ConsumerId);
}