Interface DecisionModelListener
A
DecisionModel listener that listens for requests, responses and errors,
for example to log decisions for audit, or to record metrics and traces.
All methods are called on the thread that calls the model (or, for asynchronous calls, on the thread that completes the call, which can be an I/O thread: do not block in listeners). Exceptions thrown by a listener are logged and ignored.
- Since:
- 1.21.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidonError(DecisionModelErrorContext errorContext) Called when an error occurs during the interaction with the model.default voidonRequest(DecisionModelRequestContext requestContext) Called before the request is sent to the model.default voidonResponse(DecisionModelResponseContext responseContext) Called after the response is received from the model.
-
Method Details
-
onRequest
Called before the request is sent to the model.- Parameters:
requestContext- the request and the attributes. The attributes can be used to pass data between the methods of this listener, or between multiple listeners.
-
onResponse
Called after the response is received from the model.- Parameters:
responseContext- the response, the corresponding request and the attributes.
-
onError
Called when an error occurs during the interaction with the model.- Parameters:
errorContext- the error, the corresponding request and the attributes.
-