protected void DoIndividualAcknowledge(ActiveMQMessage message)
{
MessageDispatch dispatch = null;
lock(this.dispatchedMessages)
{
foreach(MessageDispatch originalDispatch in this.dispatchedMessages)
{
if(originalDispatch.Message.MessageId.Equals(message.MessageId))
{
dispatch = originalDispatch;
this.dispatchedMessages.Remove(originalDispatch);
break;
}
}
}
if(dispatch == null)
{
Tracer.DebugFormat("Attempt to Ack MessageId[{0}] failed because the original dispatch is not in the Dispatch List", message.MessageId);
return;
}
MessageAck ack = new MessageAck();
ack.AckType = (byte) AckType.IndividualAck;
ack.ConsumerId = this.info.ConsumerId;
ack.Destination = dispatch.Destination;
ack.LastMessageId = dispatch.Message.MessageId;
ack.MessageCount = 1;
Tracer.Debug("Sending Individual Ack for MessageId: " + ack.LastMessageId.ToString());
this.session.SendAck(ack);
}