private void process(final UnsubscribeEvent event) {
        if (requestManagers.heartbeatRequestManager.isPresent()) {
            MembershipManager membershipManager = requestManagers.heartbeatRequestManager.get().membershipManager();
            CompletableFuture<Void> future = membershipManager.leaveGroup();
            future.whenComplete(complete(event.future()));
        } else {
            // If the consumer is not using the group management capabilities, we still need to clear all assignments it may have.
            subscriptions.unsubscribe();
            event.future().complete(null);
        }
    }
Process event indicating that the consumer unsubscribed from all topics. This will make
the consumer release its assignment and send a request to leave the group.

@param event Unsubscribe event containing a future that will complete when the callback
             execution for releasing the assignment completes, and the request to leave
             the group is sent out.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java