send method

  1. @override
Future send(
  1. String? correlationId,
  2. MessageEnvelope envelope
)
override

Sends a message into the queue.

  • correlationId (optional) transaction id to trace execution through call chain.
  • envelope a message envelop to be sent. Return (optional) Future that receives null for success. Throws error

Implementation

@override
Future send(String? correlationId, MessageEnvelope envelope) async {
  envelope.sent_time = DateTime.now().toUtc();
  // Add message to the queue
  _messages.add(envelope);
  counters.incrementOne('queue.' + getName() + '.sent_messages');
  logger.debug(envelope.correlation_id, 'Sent message %s via %s',
      [envelope.toString(), toString()]);
}