close method

  1. @override
Future close(
  1. String? correlationId
)
override

Closes component and frees used resources.

  • correlationId (optional) transaction id to trace execution through call chain.

Implementation

@override
Future close(String? correlationId) async {
  if (!isOpen()) {
    return Future.value(null);
  }

  try {
    // Unsubscribe from the broker
    await unsubscribe(correlationId);
  } finally {
    _messages = [];
    _receiver = null;
  }
}