Skip to content

Commit 726de4e

Browse files
committed
Readding client param into callbacks
1 parent 58e9611 commit 726de4e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

opamp-client/src/main/java/io/opentelemetry/opamp/client/OpampClient.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,30 @@ interface Callbacks {
4040
* Called when the connection is successfully established to the Server. For WebSocket clients
4141
* this is called after the handshake is completed without any error. For HTTP clients this is
4242
* called for any request if the response status is OK.
43+
*
44+
* @param client The client that's connected.
4345
*/
44-
void onConnect();
46+
void onConnect(OpampClient client);
4547

4648
/**
4749
* Called when the connection to the Server cannot be established. May also be called if the
4850
* connection is lost and reconnection attempt fails.
4951
*
52+
* @param client The client that failed to connect.
5053
* @param throwable The exception.
5154
*/
52-
void onConnectFailed(@Nullable Throwable throwable);
55+
void onConnectFailed(OpampClient client, @Nullable Throwable throwable);
5356

5457
/**
5558
* Called when the Server reports an error in response to some previously sent request. Useful
5659
* for logging purposes. The Agent should not attempt to process the error by reconnecting or
5760
* retrying previous operations. The client handles the ErrorResponse_UNAVAILABLE case
5861
* internally by performing retries as necessary.
5962
*
63+
* @param client The client that received an error response.
6064
* @param errorResponse The error returned by the Server.
6165
*/
62-
void onErrorResponse(ServerErrorResponse errorResponse);
66+
void onErrorResponse(OpampClient client, ServerErrorResponse errorResponse);
6367

6468
/**
6569
* Called when the Agent receives a message that needs processing. See {@link MessageData}
@@ -70,8 +74,9 @@ interface Callbacks {
7074
* onMessage returns. This is advisable if processing can take a long time. In that case
7175
* returning quickly is preferable to avoid blocking the {@link OpampClient}.
7276
*
77+
* @param client The client that received a message.
7378
* @param messageData The server response data that needs processing.
7479
*/
75-
void onMessage(MessageData messageData);
80+
void onMessage(OpampClient client, MessageData messageData);
7681
}
7782
}

0 commit comments

Comments
 (0)