...
As the result of the script execution we get three tags: 56 - TargetCompID, 49 - SenderCompID, 147 - State.
prepareSessionState.js |
---|
status = getStringField(147);
var regexp = /.*\s+(\S+):(\S+)\s+(.*)/g;
match = regexp.exec(status);
if (match != null)
{
target = match[1];
sender = match[2];
state = match[3];
//print("[DEBUG] matched target = " + target + " sender = " + sender + " state = " + state);
setStringField(56, target);
setStringField(49, sender);
setStringField(147, state);
} |
...
ODBC history
Database configuration
In order to save session state to the database it is required to perform the following steps::
...
Please find an example below. In this case PostgreSQL database is used.
SessionStatus.sql |
---|
create table session_actions(
id serial PRIMARY KEY,
_SenderCompId varchar(64) NOT NULL,
_TargetCompId varchar(64) NOT NULL,
_OrigTime varchar(21) NOT NULL,
_SessionState varchar(20) NOT NULL
);
CREATE OR REPLACE FUNCTION insertSessionStatus
(
_SenderCompId varchar(64),
_TargetCompId varchar(64),
_OrigTime varchar(21),
_SessionState varchar(20)
)
RETURNS void
AS $$
BEGIN
insert into session_actions(SenderCompId, TargetCompId, OrigTime, SessionState) values ( _SenderCompId, _TargetCompId, _OrigTime, _SessionState);
END;
$$
LANGUAGE plpgsql; |
FIXEdge configuration
In order to save session state into the database, BL-Rules should be configured on the FIXEdge side:
- Rule for history definition: history name, database parameters, fields definitions.
- Rule for saving to history: get message 35 = C, get session status using JavaScript, save to history (database).
BL_Config.xml |
---|
<?xml version="1.0" encoding="UTF-8"?> <!-- DB Table with Session Status --> <!-- Save Events in 35=C messages notifing about session state to DB --> <Exclusion> |
<DefaultRule> </BusinessLayer> |
File history
FIXEdge configuration
...
- Rule for history definition: history name, history file parameters, fields definitions.
- Rule for saving to history: get message 35 = C, get session status using JavaScript, save to history (file).
...
BL_Config.xml |
---|
<?xml version="1.0" encoding="UTF-8"?>
|
As a result, FIXEdge creates history file with session statuses:
SessionStatus.history |
---|
<Record valid='Y' size='/' data='SENDER1 TARGET1 20160920-13:41:32 Established'/> <Record valid='Y' size='/' data='SENDER2 TARGET2 20160920-13:41:32 Established'/> <Record valid='Y' size='8' data='SENDER1 TARGET1 20160920-21:00:01 Terminated correctly'/> <Record valid='Y' size='8' data='SENDER2 TARGET2 20160920-21:00:01 Terminated correctly'/> |