peekBatch method

  1. @override
Future<List<MessageEnvelope>> peekBatch(
  1. String? correlationId,
  2. int messageCount
)

PeekBatch method are peeks multiple incoming messages from the _queue without removing them. If there are no messages available in the _queue it returns an empty list. Parameters:

  • correlationId (optional) transaction id to trace execution through call chain.
  • messageCount a maximum number of messages to peek. Return Future that recive a list with messages Throws error

Implementation

@override
Future<List<MessageEnvelope>> peekBatch(
    String? correlationId, int messageCount) async {
//  _checkOpened(correlationId);
// 	var messages = <MessageEnvelope>[];
// 	for (;messageCount > 0;) {
// 		var envelope = _mqChanel.get(_queue, false);
// 		// if getErr != null || !ok {
// 		// 	err = getErr
// 		// 	break
// 		// }
// 		var message = _toMessage(envelope);
// 		messages.add(message);
// 		messageCount--;
// 	}
// 	logger.trace(correlationId, 'Peeked %s messages on %s', [messages.length, name]);
// 	return messages;
  throw Exception('Method "peekBatch" are not supported!');
}