This section describes configuration of event routing (Groovy rules).
eventRule method helps to build a rule for event processing. It requires a few components for its instantiation:
eventRule(String description, Class<AppEvent> eventType, Predicate<AppEvent> ruleCondition, Consumer<AppEvent> ruleAction)
description - string with free text description of the rule
- event type - type or subtype of the event for which the rule is applied
- rule condition - dynamic filter, which at the same time can check appliance of this rule depending on the event content and source attributes. The context filter can be NULL if you’d like to ignore it.
rule action - describes the main goal of the rule
The event type is a type of the events for which the rule is applied. Subtype or general type can be specified.
The table below specifies the available list of types and their methods.
|Event category||Class of event||Methods||Description|
|The basic class of all events that can be used for handling all the events the system throws.|
|Notifies about changes in the state of the FIX server.|
getSessionState(): CONNECTING, WAITING_FOR_LOGON, CONNECTED, WAITING_FOR_LOGOFF, DISCONNECTED, LOGON_RECEIVED, DEAD, DISCONNECTED_ABNORMALLY, RECONNECTING, WAITING_FOR_FORCED_LOGOFF, WAITING_FOR_FORCED_DISCONNECT
|Notifies about changes in the state of FIX sessions.|
reject(String reason, boolean quiet)
The event is intended for accepting or rejecting a new incoming session. The session will be rejected if the reject method is called. Otherwise, the session will be accepted.
NOTE: If the reject method is called, the next rule for the event will not be processed.
|getId(): String||The event that is created by the Scheduler when the trigger executes.|
|SnFEvent||getSource(): MESSAGE_WAS_QUEUED, MESSAGE_WAS_SKIPPED|
|Notifies that there is an exception in some of the rules processed.|
|getMessage(): FIXFieldList||Notifies that there are no acceptable rules defined for the specified message.|
BasicAppEvent is specified in the eventRule method as an event type parameter, all the events above will trigger the rule.
The example of the Scheduler settings: the SchedulerEvent event will be published every 10 seconds.