Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

messageRule(String description, SourceCondition sourceCondition, RuleCondition condition, RuleAction action)
  • description - string with a free text description of the rule

  • source filter - checks if this rule should be applied to messages from a certain source. This filter was added as an option with the purpose of faster work and process optimization. The filter can be applied on a the static basis without additional effects effect at runtime. The source filter is the  the SourceCondition implementation and can be NULL if you’d like to ignore it.

  • context filter - dynamic filter that, which at the same time , can check the application appliance of this rule depending on the message content and source attributes. The context filter is the RuleCondition implementation and can be NULL if you’d like to ignore it.

  • action - implementation of RuleAction that  which describes the main goal of this rule. It can be transformation, modification, or just resending to the required destination.

It is also possible to use the "helper" method in case when one of the of several sections is are not implemented.

Code Block
messageRule(description)
.action(msgCtx -> {....})
.build()

RuleDescription

Free The rule description is a free text description of the rule.

Code Block
languagegroovy
			// rule description
                "some Rule",

SourceCondition

Source The source condition is a predicate that helps do to perform optimization and prefilteringpre-filtering. It identifies if this rule should be connected to some source endpoint.

If the message rule has 'null' NULL as the a source filer, it applies to messages from all sources.

...

An instance of the EndpointParams class is passed as a parameter for SourceConditionEndpointParams and has  has the following properties, which can be checked: 

PropertyTypeDescription
idStringUnique endpoint name
sourceObjectOriginal endpoint parameters, specific to the endpoint
targetCompIdStringThe assigned value is used to identify a firm that sends data to this endpoint.
targetLocationIdStringThe assigned value is used to identify a specific source location (i.e. geographic location and/or desk, trader).
targetSubIdStringThe assigned value is used to identify a specific source (desk, trader, etc.).
senderCompIdStringThe assigned value is used to identify a receiving firm.
senderLocationIdStringThe assigned value is used to identify a unit destination’s location (i.e. geographic location and/or desk, trader).
senderSubIdStringThe assigned value is used to identify a specific individual or a unit intended to receive messages.

RuleCondition

Rule The rule condition is a predicate that identifies if a certain message should be processed by this rule.

The example below demonstrates a filter according to by the message type. The action section will be called only for Order (D) messages in the example. 

...

RuleCondition receives the RuleContext object, which includes information about the message source and the message event itself. 

The RuleContex has the table below specifies the RuleContex  properties:

PropertiesTypeDescription

message

FIXFieldListFIX message, if the source provides one.

messageEvent

MessageEventOriginal message event.

sourceParams

EndpointParams

Parameters of the source endpoint.

See the table above with available properties.

exit

booleanBooleanSpecifies not to execute any rules after execution of the current one.

RuleAction

Defines The rule action defines the actions that will be applied to the messages that correspond to the SourceCondition and RuleCondition filters. the SourceCondition and RuleCondition filters.

Example:

Code Block
languagegroovy
			// action for rule - resend message to all session within same group
            // and stop message processing
                { ctx ->
                    rc.getDestinationsByGroup(ctx.sourceParams.groups).each { adapter ->
                        adapter.send(ctx.message)
                        ctx.exit()
                    }
                } as RuleAction),

...