send method

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

Sends a message into the queue.

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

Implementation

@override
Future send(String? correlationId, MessageEnvelope message) async {
  checkOpen(correlationId);

  counters.incrementOne('queue.' + getName() + '.sent_messages');
  _logger.debug(message.correlation_id, 'Sent message %s via %s',
      [message.toString(), toString()]);

  var msg = fromMessage(message);
  var options = {'qos': _qos, 'retain': _retain};
  await _connection!.publish(msg!['topic'], msg['data'], options);
}