// ": Requeue:" + evt.getMethod().requeue +
//// ": Resend:" + evt.getMethod().resend +
// " on channel:" + channelId);
// }
AMQChannel channel = session.getChannel(channelId);
if (channel == null)
{
throw evt.getMethod().getChannelNotFoundException(channelId);
}
if (_logger.isDebugEnabled())
{
_logger.debug("Rejecting:" + evt.getMethod().deliveryTag +
": Requeue:" + evt.getMethod().requeue +
//": Resend:" + evt.getMethod().resend +
" on channel:" + channel.debugIdentity());
}
long deliveryTag = evt.getMethod().deliveryTag;
UnacknowledgedMessage message = channel.getUnacknowledgedMessageMap().get(deliveryTag);
if (message == null)
{
_logger.warn("Dropping reject request as message is null for tag:" + deliveryTag);
// throw evt.getMethod().getChannelException(AMQConstant.NOT_FOUND, "Delivery Tag(" + deliveryTag + ")not known");
}
else
{
if (message.queue == null || message.queue.isDeleted())
{
_logger.warn("Message's Queue as already been purged, unable to Reject. " +
"Dropping message should use Dead Letter Queue");
//sendtoDeadLetterQueue(msg)
return;
}
if (!message.message.isReferenced())
{
_logger.warn("Message as already been purged, unable to Reject.");
return;
}
if (_logger.isTraceEnabled())
{
_logger.trace("Rejecting: DT:" + deliveryTag + "-" + message.message.debugIdentity() +
": Requeue:" + evt.getMethod().requeue +
//": Resend:" + evt.getMethod().resend +
" on channel:" + channel.debugIdentity());
}
// If we haven't requested message to be resent to this consumer then reject it from ever getting it.
//if (!evt.getMethod().resend)
{
message.message.reject(message.message.getDeliveredSubscription(message.queue));
}
if (evt.getMethod().requeue)
{
channel.requeue(deliveryTag);
}
else
{
_logger.warn("Dropping message as requeue not required and there is no dead letter queue");
//sendtoDeadLetterQueue(AMQMessage message)