-
Notifications
You must be signed in to change notification settings - Fork 18
Monitoring events
Every communication between ratel client and server raises events that can be used to monitor application health. The events are risen when service is called and when it returns either normal or exceptional result. The following list contains all types of events currently supported by Ratel:
- RemoteServiceCallEvent is risen when a client sends a request to a remote service.
- RemoteServiceResponseEvent is risen when a client receives a response form the service (either normal or exceptional)
- ServiceInstanceCallEvent is risen when a particular instance of a service is called (on server side).
- ServiceInstanceResponseEvent is risen when a particular instance of a service provides call result (normal or exceptional).
The events contain information about creation time and ProcessContext so you can combine these monitoring events with Traceability feature to build flexible monitoring tools.
If you want to subscribe to the events, you just need to register a bean that implements one of the following interfaces:
- Instances of RemoteServiceCallListener will be notified of RemoteServiceCallEvent and RemoteServiceResponseEvent
- Instances of ServiceInstanceCallListener will be notified of ServiceInstanceCallEvent and ServiceInstanceResponseEvent
- Instances of ServiceCallListener will be notified of all four events.
Examplary use:
@Component
public class MonitoringEvent implements ServiceCallListener {
public void remoteServiceCalled(RemoteServiceCallEvent event){
//this method will be called when a client sends a request to a remote service
...
Please note that clients and services have separate contexts, (most typically they reside in different machines) so you have to monitor events separately on client and on server side. In particular, a listener registered on client side won't be notified about ServiceInstance*Events and vice-versa.