Relay Properties¶
This document contains a list of configurable properties for the Relay component and their uses.
For other components, please see these pages:
- Common (properties applicable across all AMI applications)
- Center (properties specific to the Center component)
- Web (properties specific to the Web component)
- WebBalancer and WebManager (properties for managing connections to 3forge Web)
General Relay Properties¶
Note
Property default values that are prefixed with a # are optional or must be configured by the user before use.
To run the Relay, you must include relay in the list of components found in the the ami.components property in local.properties:
By default, all three components are running. To run just the Relay component:
Relay Connection¶
Properties on configuring how connections can be made to a Relay
- Default:
- Description:
-
- Sets the name of the Relay
- This is useful for identification if multiple Relays are connected to a single Center
Note
Each Relay should have a unique ID
- Default:
- Description:
-
- Sets the port that applications connect to on the Relay's host machine
- Messages must follow the format specified on this page
- Set to
-1to disable
- Default:
- Description:
-
- Specifies the network interface that the
ami.portserver port is bound to
- Specifies the network interface that the
- Default:
- Description:
-
- Path to the keystore file (using Oracle keytool)
- Use with the
ami.port.keystore.passwordproperty
- Default:
- Description:
-
- Password associated to the keystore file
- Default:
- Description:
-
- Provides either a list of permitted hostname patterns, or a plugin for blocking/granting access based on foreign network address
-
Options syntax:
- file:
file:<file_containing_a_hostname_patterns_per_line\> - text:
text:<newline_delimited_list_of_hostname_patterns> - plugin:
plugin:<class_name_implementing_com.f1.ami.amicommon.AmiServerSocketEntitlementsPlugin\>
- file:
- Default:
- Description:
-
- The duration to wait for the Center to start up
- Default:
-
See the full list here:
Datasource adapter list
- Description:
-
- Default datasource adapters are provided by 3forge and implement the
AmiDatasourcePlugininterface - For custom adapters that we do not provide, see this documentation to write your own
- Default datasource adapters are provided by 3forge and implement the
- Default:
- Description:
-
- Sets the hostname of the primary Center instance this Relay is connected to
- Default:
- Description:
-
- Sets the port of the primary Center instance this Relay is connected to
- Default:
- Description:
-
- Comma delimted list of centers'
host:portto connect to - You can optionally prefix a
host:portwith an alias in the formalias=host:port, in which case the alias will be used to reference the Center within the dashboard - Note, the first supplied URL is considered the primary center. e.g:
ami.centers=myprimary=localhost:3270,other=some.host.com:3270
- Comma delimted list of centers'
ami.center.<NAME>.keystore.file
- Default:
- Description:
-
- Supply if the Center is using an SSL connection
- Path to the keystore file (using Oracle keytool)
NAMEis the Center's name as it appears inami.centersproperty- Use either with
ami.center.<NAME>.keystore.contents.base64orami.center.<NAME>.keystore.password
ami.center.<NAME>.keystore.password
- Default:
- Description:
-
- Supply if the Center is using an SSL connection
- Password associated to the keystore file in
ami.center.<NAME>.keystore.file NAMEis the Center name as it appears inami.centersproperty
ami.center.<NAME>.contents.base64
- Default:
- Description:
-
- Alternative to supplying the keystore file if the Center is using an SSL connection
- Supply the contents of a keystore as base64
NAMEis the Center name as it appears inami.centersproperty
Relay Logging¶
ami.relay.guaranteed.messaging.enabled
- Default:
- Description:
-
- If true, the Relay will use a store-and-forward journal to record messages to disk prior to an ACK message being sent to the originating client
- The journal can also be used to deliver messages to late-subscribing Centers
- Default:
- Description:
-
- Where to store the recovery journal files if
ami.relay.guaranteed.messaging.enabledis set totrue
- Where to store the recovery journal files if
- Default:
- Description:
-
- If set to true, all messages sent into and out of the Relay to/from other applications will be logged to a file
- Default:
- Description:
-
- If set to true, the relay will send a CR back on each response, in addition to a new line
Email¶
3forge can be used to send emails. For an overview of how this works, see the interoperability guide.
To configure email settings, you will need to know the SMTP information of your email provider.
At a minimum, you will need to provide the following configuration:
A full list of available properties is listed below.
Email Properties¶
- Default:
- Description:
-
- SMTP server to connect to
- Default:
- Description:
-
- The SMTP server port to connect to
- Default:
- Description:
-
- Email account username
- Default:
- Description:
-
- Email account password
- Default:
- Description:
-
- Attempts to connect via SSL if enabled
- Default:
- Description:
-
- Specifies which SSL protocol the email client is using
- Equivalent to the JavaMail property
mail.smtp.ssl.protocolsand has the same valid options
email.client.start.tls.enabled
- Default:
- Description:
-
- Attempts to connect via TLS if supported by the server
- Default:
- Description:
-
- Number of attempts to reconnect to SMTP server if connection fails
- Default:
- Description:
-
- Determines whether to exit 3forge if there is an email connection error
- Set to
falseto keep 3forge running even if email connection fails
email.client.connection.timeout
- Default:
- Description:
-
- Upon losing connection with the email client, how long to wait before timing it out
- Default behavior disables timeout
- Default:
- Description:
-
- How long to wait before timing out the email client
- Default behavior disables timeout
- Default:
- Description:
-
- How long to wait before timing out a write operation
- Default behavior disables timeout
- Default:
- Description:
-
- If set to
true, allows 3forge to add email-related information to the log
- If set to
Relay Transformations¶
By default, Relays connected to multiple Centers will send messages to all Centers.
It is possible to route messages only to specific Centers, or implement transformations to map messages to a specific format before reaching a given center to avoid redundant calculations.
To set up Relay transformations, you will need the following files:
-
- Defines the transformations of some Relay message.
-
- Defines which Centers the messages are routed to.
-
<SOME_FILE>.relay.dictionary- Defines the specific mapping of some Relay message.
These files are used to define any transformation logic the Relay should perform before sending messages to the Center, and which Centers they should be sent to.
The configurable properties for using Relay transformations is listed below.
Relay Transformation Properties¶
- Default:
- Description:
-
- File containing Relay transformation rules to be applied
- See the
relay.transformsfile below for details
- Default:
- Description:
-
- Optional logging file
- Default:
- Description:
-
- Files containing dictionaries for Relay transform mappings
- Alternatively can be supplied as a comma-delimited list of different dictionary files
- See the
relay.transformsand Dictionary Files sections below for details
- Default:
- Description:
-
- File containing routing tables used for controlling which real-time streaming messages are sent to which center(s)
- See the Relay Routes file below for details
- If a file is not found, a placeholder with instructions will be created
- Default:
- Description:
-
- Comma-delimited list of AmiScript functions to disable in Relay
- Leave blank to enable all functions
- We recommend using the default values if using a WebManager
relay.transforms File¶
Relay transformations are applied to messages that are arriving from some feed handler before they are routed and then processed by a Center.
This reduces overall computation by the Center by ensuring messages are in the correct format for each Center they are intended for.
Relay transformations are defined in the relay.transforms file where each line describes a transformation rule with the format:
Each parameter is detailed below.
| Parameter | Description |
|---|---|
TRANSFORM_NAME |
Unique name of the transform. |
PRIORITY |
Highest priority executes first. Lower numbers have higher priority, with 0 being the highest priority. Ties determined using alphabetical route name. |
OBJECT_TYPES |
Comma delimited list of types (T=...) to evaluate by this transform. Blank - skip rule, * - all types, Use Target=Source to map. |
DICTIONARY |
Optional dictionary to apply form transforming fields. If empty, no field transforms are applied. |
EXPRESSION |
Expression to evaluate on source values, must return boolean. True return value indicates rule succeeded. |
OPTIONS |
Comma delimited list of options: PASSTHROUGH - Include unmapped fields in the output. |
ON_TRUE |
Action if Table matches: BREAK - stop evaluating rules, blank - continue evaluating next rule. |
ON_FALSE |
Action if Table does not match: BREAK - stop evaluating rules, blank - Continue evaluating next rule. |
Dictionary Files¶
To specify the actual mapping, a transform rule uses requires a dictionary file in the format <some_dictionary>.relay.dictionary.
This should contain the mapping for any transform methods that are called in relay.transforms (corresponding to the DICTIONARY parameter). For example:
This transforms a message with an input parameter of "44" to be processed by the Center with the key "price" instead.
Dictionaries can also be used to extend one another. For example:
FixDictionary extends the RawFix dictionary so that it also maps the input key "55" to a column titled "sym" and then capitalizes the input string using the Center method toUpper().
Relay transformations can apply Center methods, such as timestamp(). To see a full list of accepted methods for Relay transformations, run the command SHOW METHODS; in the AMIDB Shell Tool.
Example¶
In the amione/data directory, create a sample.relay.dictionary file with the following dictionaries:
In relay.transforms, add the following lines:
Fix-style messages will be inserted into a3forge table with two transformations applied:
- Transforms the headers into "price" and "sym."
- Takes the time the message was sent and converts it into a readable date format.
Send the following message to the relay via the configured ami.port (this is 3289 by default):
This will create a table "sample_fix" in the Center and insert the following row.
relay.routes File¶
Any number of Relays can be connected to any number of Centers that have been specified in the properties (ami.centers). By default, as messages are sent from an external source into a Relay, they are forwarded to all Centers.
To determine if messages should be sent to specific Centers, rules can be added to the relay.routes file. This allows you to control which Centers are receiving messages based on some parameters within a message and/or the structure of the message itself.
Note
To support dynamic routing, changes to this file during runtime will take effect immediately.
Each line in the Relay routes file is an isolated rule, with the following format:
| Parameter | Description |
|---|---|
ROUTE_NAME |
Unique name of rule |
PRIORITY |
Higher priority rules execute first. Lower numbers have higher priority, with 0 being the highest priority. Ties are determined using alphabetical route name. |
MESSAGE_TYPES |
Comma delimited list of messages types. Only O (object), D (delete), C (Command) and S (Status) are supported, * - all types. |
OBJECT_TYPES |
Comma delimited list of types to evaluate by this rule. Blank - skip rule, * - all. types. |
PARAM_TYPES |
Comma delimited list of param types for the rule in the format: Name Type [nonull] |
EXPRESSION |
Expression to evaluate, must return boolean. True return value indicates rule succeeded. |
ROUTE_LIST |
Comma delimited list of centers to send message to. Blank - no centers, * - all. servers. |
ON_TRUE |
Action if Expression returns true: BREAK - stop evaluating rules, blank or CONTINUE - continue evaluating next rule. |
ON_FALSE |
Action if Expression returns false or null: BREAK - stop evaluating rules, blank or CONTINUE - Continue evaluating next rule. |
Starting at the highest priority rule (lowest number), if the MESSAGE_TYPES and OBJECT_TYPES and PARAM_TYPES match the message, then the fields defined in the PARAM_TYPES are extracted from the message and passed into the EXPRESSION. If the expression returns "true", then the message is sent to all Centers in the ROUTE_LIST. The ON_TRUE, ON_FALSE determine what logic should be exectued next dependant on the outcome.
Notes¶
- Lines starting with a hash (#) are considered comments and skipped
- A particular message will only be sent to a particular Center at most once, regardless of how many rules it matches
Example¶
Example messages:
