Skip to content

Added a new listener for events related to Client#1344

Draft
neenapj wants to merge 2 commits into
jakartaee:mainfrom
neenapj:1283-onClose-event
Draft

Added a new listener for events related to Client#1344
neenapj wants to merge 2 commits into
jakartaee:mainfrom
neenapj:1283-onClose-event

Conversation

@neenapj

@neenapj neenapj commented Jun 12, 2026

Copy link
Copy Markdown

No description provided.

@jamezp

jamezp commented Jun 16, 2026

Copy link
Copy Markdown
Member

I think the ClientListener should be an interface with default no-op methods. Something like:

public interface ClientListener {
    
    default void connected(final Client client) {
         // no-op
    }
    
    default void closed(final Client client) {
         // no-op
    }

    default void connectionFailed(final Client client, final Throwable cause) {
         // no-op
    }

    default void reconnecting(final Client client, final Throwable cause) {
         // no-op
    }
}

We don't really want to use an enum because it can make it migrations more difficult. Using an interface with no-ops by default allows implementors to implement what they want and not fail if a new enum is not handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants