cometd-java/cometd-java-common/src/main/java/org/cometd/common/AbstractClientSession.java
/**
     * <p>Receives a message (from the server) and process it.</p>
     * <p>Processing the message involves calling the receive {@link Extension extensions}
     * and the channel {@link ClientSessionChannel.ClientSessionChannelListener listeners}.</p>
     *
     * @param message the message received.
     * @param promise the promise notified of the receive processing
     */
Receives a message (from the server) and process it.
Processing the message involves calling the receive  Extension extensions
and the channel  ClientSessionChannel.ClientSessionChannelListener listeners.

@param message the message received.
@param promise the promise notified of the receive processing
Receives a message ( from the server ) and process it . Processing the message involves calling the receive Extension extensions and the channel ClientSessionChannel . ClientSessionChannelListener listeners . @param message the message received . @param promise the promise notified of the receive processing
public void receive(Message.Mutable message, Promise<Void> promise) {
        String channelName = message.getChannel();
        if (channelName == null) {
            promise.fail(new IllegalArgumentException("Bayeux message must have a channel: " + message));
            return;
        }
        if (Channel.META_SUBSCRIBE.equals(channelName)) {
            ClientSessionChannel.MessageListener subscriber = unregisterSubscriber(message.getId());
            if (!message.isSuccessful()) {
                String subscription = (String)message.get(Message.SUBSCRIPTION_FIELD);
                MarkedReference<AbstractSessionChannel> channelRef = getReleasableChannel(subscription);
                AbstractSessionChannel channel = channelRef.getReference();
                channel.removeSubscription(subscriber);
                if (channelRef.isMarked()) {
                    channel.release();
                }
            }
        }
        extendIncoming(message, Promise.from(pass -> {
            if (pass) {
                if (message.isPublishReply() && message.isSuccessful()) {
                    notifyListeners(message);
                } else {
                    if (!handleRemoteCall(message)) {
                        notifyListeners(message);
                    }
                }
            } else {
                unregisterCallback(message.getId());
            }
            promise.succeed(null);
        }, promise::fail));
    }
public void receive ( Message . Mutable message , Promise < Void > promise ) { String channelName = message . getChannel ( ) ; if ( channelName == null ) { promise . fail ( new IllegalArgumentException ( "Bayeux message must have a channel: " + message ) ) ; return ; } if ( Channel . META_SUBSCRIBE . equals ( channelName ) ) { ClientSessionChannel . MessageListener subscriber = unregisterSubscriber ( message . getId ( ) ) ; if ( ! message . isSuccessful ( ) ) { String subscription = ( String ) message . get ( Message . SUBSCRIPTION_FIELD ) ; MarkedReference < AbstractSessionChannel > channelRef = getReleasableChannel ( subscription ) ; AbstractSessionChannel channel = channelRef . getReference ( ) ; channel . removeSubscription ( subscriber ) ; if ( channelRef . isMarked ( ) ) { channel . release ( ) ; } } } extendIncoming ( message , Promise . from ( pass -> { if ( pass ) { if ( message . isPublishReply ( ) && message . isSuccessful ( ) ) { notifyListeners ( message ) ; } else { if ( ! handleRemoteCall ( message ) ) { notifyListeners ( message ) ; } } } else { unregisterCallback ( message . getId ( ) ) ; } promise . succeed ( null ) ; } , promise :: fail ) ) ; }
<p>Receives a message (from the server) and process it.</p>
 <p>Processing the message involves calling the receive {@link Extension extensions}
 and the channel {@link ClientSessionChannel.ClientSessionChannelListener listeners}.</p>
<p > Receives a message ( from the server ) and process it . < / p > <p > Processing the message involves calling the receive { @link Extension extensions } and the channel { @link ClientSessionChannel . ClientSessionChannelListener listeners } . < / p >
// Remove the subscriber if the subscription fails.