Class HttpClientStatusEventBus
java.lang.Object
com.predic8.membrane.core.transport.http.HttpClientStatusEventBus
Event bus for outcomes of the HttpClient.
Because the HttpClient is smart (does internal auto-retry and destination switching), just looking at the result is not always enough. To be informed about what's going on with each individual destination, this event bus can be used.
How to use: HttpClientStatusEventBus.getService().registerListener(new HttpClientStatusEventListener() {});
The HttpClient then calls methods in here, including reportResponse(java.lang.String, int), which goes through to your
event listener as HttpClientStatusEventListener.onResponse(long, java.lang.String, int).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener to be informed about events.voidreportException(String destination, Exception exception) voidreportResponse(String destination, int responseCode)
-
Field Details
-
EXCHANGE_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
HttpClientStatusEventBus
public HttpClientStatusEventBus()
-
-
Method Details
-
registerListener
Adds a listener to be informed about events. The listener is added at the end of the list, thus being called after already registered ones.- Throws:
IllegalStateException- if the method detects that the listener is registered already. Except for a tiny small time frame because the operations are not atomic, it will be detected. If not, you end up having it registered twice.
-
reportResponse
-
reportException
- Parameters:
destination-
-