moveToDeadLetter method

  1. @override
Future moveToDeadLetter(
  1. MessageEnvelope message
)
override

Permanently removes a message from the queue and sends it to dead letter queue.

  • message a message to be removed. Return (optional) Future that receives or null for success. Throws error

Implementation

@override
Future moveToDeadLetter(MessageEnvelope message) async {
  if (message.getReference() == null) {
    return null;
  }

  int lockedToken = message.getReference();
  _lockedMessages.remove(lockedToken);
  message.setReference(null);

  counters.incrementOne('queue.' + getName() + '.dead_messages');
  logger.trace(message.correlation_id, 'Moved to dead message %s at %s',
      [message, toString()]);
}