Filter - Xyna-Factory/xyna GitHub Wiki
Filters in cooperation with Triggers are coded Deployment Items that can create new Xyna Orders based on a Trigger event.
The Deployment Item (containing JAR file and configuration) of a Filter is first registered in Xyna Factory, and afterwards a corresponding Filter Instance is registered at one or more existing Trigger Instances. A Trigger Instance may be connected to multiple Filter Instances.
Typically Triggers abstract network protocols such as HTTP or DHCP. Each event corresponds to a socket or a TCP connection. A Trigger listens on a server socket for incoming requests and creates events for each of them. Filters then have the task of deciding what to do with these events. Often a Filter transforms the event data (packets) into Data Types that can be used as Input to start a Workflow via a Xyna Order. If the protocol needs to send a response to the client, this can be done with the data the Workflow produces.
Whenever a Trigger Instance creates a new event, it is given to all Filter Instances in sequence. Each Filter Instance may react in the following ways:
- Accept the event and create a new Xyna Order. No other Filter Instance is notified of the event.
- Accept the event and don't create a Xyna Order. No other Filter Instance is notified of the event.
- Do not accept the event. The next Filter Instance will be tried.
Management of Filters is mainly done on the CLI:
''# Creating a Filter Instance'' ./xynafactory.sh '''help''' deployfilter ''# Enabling or disabling'' ./xynafactory.sh '''help''' dis/en-ablefilterinstance ''# Create a [[Java Template]] for a new Filter implementation'' ./xynafactory.sh '''help''' buildfilterproject
When a Filter is used in an Application, it can be enabled/disabled by stopping or starting the Application.
If a Filter starts Xyna Orders it has to define the used objects (Data Types, Order Types, Exception Types) in a XML file. Syntax:
<Filter>
<AdditionalDependencies>
<Datatype>xact.http.URLPath</Datatype>
<Ordertype>someordertype</Ordertype>
<Datatype>xact.http.Method</Datatype>
<ExceptionType>xact.http.UnsupportedOperation</ExceptionType>
</AdditionalDependencies>
</Filter>
See also the javadoc of the Java Template.