Table of Contents
...
FEJ uses Spring Security for authentication purposes. Security configuration is stored in fej-security.xml
file.
In-Memory Authentication
By default, for testing purposes, FEJ container uses simple in-memory authentication with NoOpPasswordEncoder encoder and plain-text credentials.
For other password encoder options please check Spring Security 5.0 DelegatingPasswordEncoder. If you need more complex authentication solution please refer to Spring Security documentation.
Code Block | ||
---|---|---|
| ||
<bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder" factory-method="getInstance"/> <sec:authentication-manager id="authenticationManager"> <sec:authentication-provider> <sec:password-encoder ref="passwordEncoder"/> <sec:user-service id="userDetailsService" properties="users.properties"/> </sec:authentication-provider> </sec:authentication-manager> |
...
Code Block | ||
---|---|---|
| ||
$ pwd /usr/share/fixedgej-1.0.0/conf $ cat users.properties test=test,ROLE_ADMIN,enabled |
LDAP authentication
FEJ also supports authentication against an LDAP server.
Before getting deep into LDAP authentication, let’s get familiar with some LDAP terms.
Term | Description |
---|---|
Dn | Distinguished name, a unique name which is used to find user in LDAP server e.g. Microsoft Active Directory. |
Ou | Organization Unit. |
Bind | LDAP Bind is an operation in which LDAP clients sends bindRequest to LDAP user including username and password and if |
Search | LDAP search is the operation which is performed to retrieve Dn of user by using some user credentials. |
Root | LDAP directory’s top element, like root of a tree. |
BaseDn | a branch in LDAP tree which can be used as base for LDAP search operation. |
When the LDAP authentication option is activated, the default single user mode is turned off.
FIX Session configuration
FIX Antenna java is used for establishing and managing FIX sessions. But FEJ introduce per-file base configuration for each FIX session. All such configuration files are placed into subdirectories of session
directory and should follow s_fix_[SESSION_ID].properties
mask (this behaviour can be changed with 'sessionConfigManager' bean into fej-server.xml
). Additional each subfolder may have SESSION_GROUP_s_fixDefault.properties
configuration file which define common option for all group of FIX sessions.
Main options for FIX session(advanced options for FIX session you can find on FIX Antenna Java configuration page):
Property name | Default value | Description |
---|---|---|
sessionType | acceptor | Session type. If type is not defined then session will be resolved as acceptor. Valid values: acceptor/initiator. |
host | The connecting host for initiator session | |
port | The connecting port for initiator session | |
senderCompID | Assigned value used to identify firm sending message | |
senderSubID | Assigned value used to identify specific message originator (desk, trader, etc.) | |
senderLocationID | Assigned value used to identify specific message originator’s location (i.e. geographic location and/or desk, trader) | |
targetCompID | Assigned value used to identify receiving firm | |
targetSubID | Assigned value used to identify specific individual or unit intended to receive message | |
targetLocationID | Assigned value used to identify specific message destination’s location (i.e. geographic location and/or desk, trader) | |
fixVersion | Version of the FIX protocol | |
appVersion | ||
backupHost | Backup host for initiator session | |
backupPort | Backup port for initiator session | |
incomingSequenceNumber | 0 | Incoming sequence number |
outgoingSequenceNumber | 0 | Outgoing sequence number |
processedIncomingSequenceNumber | 0 | Last valid incoming sequence number |
heartbeatInterval | 30 | Heartbeat interval (in seconds) |
lastSeqNumResetTimestamp | ||
fixFieldList | User-defined fields for messages. If this list is not empty, Engine |
adds it to each outgoing message. | ||
outgoingLoginFixFieldList | Additional fields for outgoing Logon message | |
groups |
A comma-separated list of routing groups | ||
username | The assigned value used to identify a username to send in Logon message for initiator session and username to validate with |
user name from Logon request for acceptor session. The session will be accepted if the username is not defined. | ||
password | The assigned value used to identify a password to send in Logon message for initiator session and password to validate with password from logon request for acceptor session. The session will be accepted if the password is not defined | |
disposeOnDisconnect | false | Disposes FIX session when another side breaks the connection or in case of disconnect. More details about session statuses can be found in the FIX Antenna java documentation. note: If the property is set to 'true' then reconnect logic will be suppressed. |
Custom FIX dictionaries setup
Custom FIX dictionaries setup in FIXEdge Java product based on FIX Antenna custom FIX dictionaries setup (FIX Antenna Java custom dictionaries), but it is FIXEdge Java configuration specific (FIXEdge Java FIX session configuration).
First place 'customFIXVersions' section first into default 'fixengine.properties' file (in conf dir) to set up custom FIX version info for all FIX sessions.
Code Block | ||||
---|---|---|---|---|
| ||||
# comma separated list of custom FIX dictionary aliases
customFixVersions=FIX44Custom,FIX50Custom
# pair of 'fixVersion' and 'fileName' for each FIX dictionary alias with pattern:
# customFixVersion.<custom FIX version alias>.fixVersion=<base standard FIX version>
# customFixVersion.<custom FIX version alias>.fileName=<custom FIX dictionary file name>
# example of custom FIX dictionary based on FIX.4.4
customFixVersion.FIX44Custom.fixVersion=FIX.4.4
customFixVersion.FIX44Custom.fileName=classpath:fixdic44-custom.xml
# examples of custom FIX dictionary based on FIX.5.0
customFixVersion.FIX50Custom.fixVersion=FIX.5.0
customFixVersion.FIX50Custom.fileName=classpath:fixdic50-custom.xml
|
The next step is to set defined dictionary aliases as a session's fixVersion or appVersion in the appropriate FIXEdge Java session configuration file 's_fix_[SESSION_ID].properties':
Code Block | ||||
---|---|---|---|---|
| ||||
# FIXEdge Java session configuration properties
fixVersion=FIX44Custom
|
Code Block | ||||
---|---|---|---|---|
| ||||
# FIXEdge Java session configuration properties
fixVersion=FIX50Custom
|
Scheduling
Background and business purpose
Exchanges have business hours and there cannot be possible to keep a session up all the time. We should use scheduling in the case when we need to start or stop our session by timetable.
Overview
FEJ supports two modes of managing session - immediately while starting and postponed using cron expression. Managing of the timetable can be defined in schedules.xml that is located in the configuration folder.
Deployment and Maintenance
Configuration
The configuration has the following skillet
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<schedules xmlns="http://epam.com/fej/schedules">
<schedule id="...">
<task name="..." onLoad="..." timeZone="">
<event cron="..."/>
<properties>
<property key="..." value="..."/>
</properties>
</task>
<task name="..." >
..
</task>
</schedule>
</schedules> |
- schedule
- id - id of schedule. This parameter will be used as the name of a session if properties are not defined. Required. Id of a session is taken from files with its parameters by the regexp - " s_fix_(.*)\.properties". It can be changed in fej-server.xml. parameter sessionNamePattern of sessionConfigManager.
- task - there can be many tasks - two (start and stop) for one session where properties block is not defined or many tasks for many sessions but in this case properties block should be defined to specify on which session the task will be applied.
- name - name[type] of task
Valid values:
start
stop - onLoad - whether a session should start during FEJ initialization. If true, the event block will be ignored.
- timeZone - time zone for cron expression. Valid values are below. Required for cron expression.
- name - name[type] of task
- event - used only when onLoad is not defined or false.
- cron - cron expression
- property
- key - valid value:
'sessionName' - used for determining session name. If the properties section is not defined then the id of schedule will be used as a session name.
- key - valid value:
Expand | ||
---|---|---|
| ||
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
Africa/Juba
Africa/Kampala
Africa/Khartoum
Africa/Kigali
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Lome
Africa/Luanda
Africa/Lubumbashi
Africa/Lusaka
Africa/Malabo
Africa/Maputo
Africa/Maseru
Africa/Mbabane
Africa/Mogadishu
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
Africa/Niamey
Africa/Nouakchott
Africa/Ouagadougou
Africa/Porto-Novo
Africa/Sao_Tome
Africa/Timbuktu
Africa/Tripoli
Africa/Tunis
Africa/Windhoek
America/Adak
America/Anchorage
America/Anguilla
America/Antigua
America/Araguaina
America/Argentina/Buenos_Aires
America/Argentina/Catamarca
America/Argentina/ComodRivadavia
America/Argentina/Cordoba
America/Argentina/Jujuy
America/Argentina/La_Rioja
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Argentina/Salta
America/Argentina/San_Juan
America/Argentina/San_Luis
America/Argentina/Tucuman
America/Argentina/Ushuaia
America/Aruba
America/Asuncion
America/Atikokan
America/Atka
America/Bahia
America/Bahia_Banderas
America/Barbados
America/Belem
America/Belize
America/Blanc-Sablon
America/Boa_Vista
America/Bogota
America/Boise
America/Buenos_Aires
America/Cambridge_Bay
America/Campo_Grande
America/Cancun
America/Caracas
America/Catamarca
America/Cayenne
America/Cayman
America/Chicago
America/Chihuahua
America/Coral_Harbour
America/Cordoba
America/Costa_Rica
America/Creston
America/Cuiaba
America/Curacao
America/Danmarkshavn
America/Dawson
America/Dawson_Creek
America/Denver
America/Detroit
America/Dominica
America/Edmonton
America/Eirunepe
America/El_Salvador
America/Ensenada
America/Fort_Wayne
America/Fortaleza
America/Glace_Bay
America/Godthab
America/Goose_Bay
America/Grand_Turk
America/Grenada
America/Guadeloupe
America/Guatemala
America/Guayaquil
America/Guyana
America/Halifax
America/Havana
America/Hermosillo
America/Indiana/Indianapolis
America/Indiana/Knox
America/Indiana/Marengo
America/Indiana/Petersburg
America/Indiana/Tell_City
America/Indiana/Vevay
America/Indiana/Vincennes
America/Indiana/Winamac
America/Indianapolis
America/Inuvik
America/Iqaluit
America/Jamaica
America/Jujuy
America/Juneau
America/Kentucky/Louisville
America/Kentucky/Monticello
America/Knox_IN
America/Kralendijk
America/La_Paz
America/Lima
America/Los_Angeles
America/Louisville
America/Lower_Princes
America/Maceio
America/Managua
America/Manaus
America/Marigot
America/Martinique
America/Matamoros
America/Mazatlan
America/Mendoza
America/Menominee
America/Merida
America/Metlakatla
America/Mexico_City
America/Miquelon
America/Moncton
America/Monterrey
America/Montevideo
America/Montreal
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
America/North_Dakota/Beulah
America/North_Dakota/Center
America/North_Dakota/New_Salem
America/Ojinaga
America/Panama
America/Pangnirtung
America/Paramaribo
America/Phoenix
America/Port-au-Prince
America/Port_of_Spain
America/Porto_Acre
America/Porto_Velho
America/Puerto_Rico
America/Rainy_River
America/Rankin_Inlet
America/Recife
America/Regina
America/Resolute
America/Rio_Branco
America/Rosario
America/Santa_Isabel
America/Santarem
America/Santiago
America/Santo_Domingo
America/Sao_Paulo
America/Scoresbysund
America/Shiprock
America/Sitka
America/St_Barthelemy
America/St_Johns
America/St_Kitts
America/St_Lucia
America/St_Thomas
America/St_Vincent
America/Swift_Current
America/Tegucigalpa
America/Thule
America/Thunder_Bay
America/Tijuana
America/Toronto
America/Tortola
America/Vancouver
America/Virgin
America/Whitehorse
America/Winnipeg
America/Yakutat
America/Yellowknife
Antarctica/Casey
Antarctica/Davis
Antarctica/DumontDUrville
Antarctica/Macquarie
Antarctica/Mawson
Antarctica/McMurdo
Antarctica/Palmer
Antarctica/Rothera
Antarctica/South_Pole
Antarctica/Syowa
Antarctica/Troll
Antarctica/Vostok
Arctic/Longyearbyen
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Ashgabat
Asia/Ashkhabad
Asia/Baghdad
Asia/Bahrain
Asia/Baku
Asia/Bangkok
Asia/Beirut
Asia/Bishkek
Asia/Brunei
Asia/Calcutta
Asia/Chita
Asia/Choibalsan
Asia/Chongqing
Asia/Chungking
Asia/Colombo
Asia/Dacca
Asia/Damascus
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Gaza
Asia/Harbin
Asia/Hebron
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Hovd
Asia/Irkutsk
Asia/Istanbul
Asia/Jakarta
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kashgar
Asia/Kathmandu
Asia/Katmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macao
Asia/Macau
Asia/Magadan
Asia/Makassar
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Novokuznetsk
Asia/Novosibirsk
Asia/Omsk
Asia/Oral
Asia/Phnom_Penh
Asia/Pontianak
Asia/Pyongyang
Asia/Qatar
Asia/Qyzylorda
Asia/Rangoon
Asia/Riyadh
Asia/Saigon
Asia/Sakhalin
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Srednekolymsk
Asia/Taipei
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Tel_Aviv
Asia/Thimbu
Asia/Thimphu
Asia/Tokyo
Asia/Ujung_Pandang
Asia/Ulaanbaatar
Asia/Ulan_Bator
Asia/Urumqi
Asia/Ust-Nera
Asia/Vientiane
Asia/Vladivostok
Asia/Yakutsk
Asia/Yekaterinburg
Asia/Yerevan
Atlantic/Azores
Atlantic/Bermuda
Atlantic/Canary
Atlantic/Cape_Verde
Atlantic/Faeroe
Atlantic/Faroe
Atlantic/Jan_Mayen
Atlantic/Madeira
Atlantic/Reykjavik
Atlantic/South_Georgia
Atlantic/St_Helena
Atlantic/Stanley
Australia/ACT
Australia/Adelaide
Australia/Brisbane
Australia/Broken_Hill
Australia/Canberra
Australia/Currie
Australia/Darwin
Australia/Eucla
Australia/Hobart
Australia/LHI
Australia/Lindeman
Australia/Lord_Howe
Australia/Melbourne
Australia/NSW
Australia/North
Australia/Perth
Australia/Queensland
Australia/South
Australia/Sydney
Australia/Tasmania
Australia/Victoria
Australia/West
Australia/Yancowinna
Brazil/Acre
Brazil/DeNoronha
Brazil/East
Brazil/West
CET
CST6CDT
Canada/Atlantic
Canada/Central
Canada/East-Saskatchewan
Canada/Eastern
Canada/Mountain
Canada/Newfoundland
Canada/Pacific
Canada/Saskatchewan
Canada/Yukon
Chile/Continental
Chile/EasterIsland
Cuba
EET
EST5EDT
Egypt
Eire
Etc/GMT
Etc/GMT+0
Etc/GMT+1
Etc/GMT+10
Etc/GMT+11
Etc/GMT+12
Etc/GMT+2
Etc/GMT+3
Etc/GMT+4
Etc/GMT+5
Etc/GMT+6
Etc/GMT+7
Etc/GMT+8
Etc/GMT+9
Etc/GMT-0
Etc/GMT-1
Etc/GMT-10
Etc/GMT-11
Etc/GMT-12
Etc/GMT-13
Etc/GMT-14
Etc/GMT-2
Etc/GMT-3
Etc/GMT-4
Etc/GMT-5
Etc/GMT-6
Etc/GMT-7
Etc/GMT-8
Etc/GMT-9
Etc/GMT0
Etc/Greenwich
Etc/UCT
Etc/UTC
Etc/Universal
Etc/Zulu
Europe/Amsterdam
Europe/Andorra
Europe/Athens
Europe/Belfast
Europe/Belgrade
Europe/Berlin
Europe/Bratislava
Europe/Brussels
Europe/Bucharest
Europe/Budapest
Europe/Busingen
Europe/Chisinau
Europe/Copenhagen
Europe/Dublin
Europe/Gibraltar
Europe/Guernsey
Europe/Helsinki
Europe/Isle_of_Man
Europe/Istanbul
Europe/Jersey
Europe/Kaliningrad
Europe/Kiev
Europe/Lisbon
Europe/Ljubljana
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
Europe/Mariehamn
Europe/Minsk
Europe/Monaco
Europe/Moscow
Europe/Nicosia
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
Europe/San_Marino
Europe/Sarajevo
Europe/Simferopol
Europe/Skopje
Europe/Sofia
Europe/Stockholm
Europe/Tallinn
Europe/Tirane
Europe/Tiraspol
Europe/Uzhgorod
Europe/Vaduz
Europe/Vatican
Europe/Vienna
Europe/Vilnius
Europe/Volgograd
Europe/Warsaw
Europe/Zagreb
Europe/Zaporozhye
Europe/Zurich
GB
GB-Eire
GMT
GMT0
Greenwich
Hongkong
Iceland
Indian/Antananarivo
Indian/Chagos
Indian/Christmas
Indian/Cocos
Indian/Comoro
Indian/Kerguelen
Indian/Mahe
Indian/Maldives
Indian/Mauritius
Indian/Mayotte
Indian/Reunion
Iran
Israel
Jamaica
Japan
Kwajalein
Libya
MET
MST7MDT
Mexico/BajaNorte
Mexico/BajaSur
Mexico/General
NZ
NZ-CHAT
Navajo
PRC
PST8PDT
Pacific/Apia
Pacific/Auckland
Pacific/Bougainville
Pacific/Chatham
Pacific/Chuuk
Pacific/Easter
Pacific/Efate
Pacific/Enderbury
Pacific/Fakaofo
Pacific/Fiji
Pacific/Funafuti
Pacific/Galapagos
Pacific/Gambier
Pacific/Guadalcanal
Pacific/Guam
Pacific/Honolulu
Pacific/Johnston
Pacific/Kiritimati
Pacific/Kosrae
Pacific/Kwajalein
Pacific/Majuro
Pacific/Marquesas
Pacific/Midway
Pacific/Nauru
Pacific/Niue
Pacific/Norfolk
Pacific/Noumea
Pacific/Pago_Pago
Pacific/Palau
Pacific/Pitcairn
Pacific/Pohnpei
Pacific/Ponape
Pacific/Port_Moresby
Pacific/Rarotonga
Pacific/Saipan
Pacific/Samoa
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Truk
Pacific/Wake
Pacific/Wallis
Pacific/Yap
Poland
Portugal
ROK
Singapore
SystemV/AST4
SystemV/AST4ADT
SystemV/CST6
SystemV/CST6CDT
SystemV/EST5
SystemV/EST5EDT
SystemV/HST10
SystemV/MST7
SystemV/MST7MDT
SystemV/PST8
SystemV/PST8PDT
SystemV/YST9
SystemV/YST9YDT
Turkey
UCT
US/Alaska
US/Aleutian
US/Arizona
US/Central
US/East-Indiana
US/Eastern
US/Hawaii
US/Indiana-Starke
US/Michigan
US/Mountain
US/Pacific
US/Pacific-New
US/Samoa
UTC
Universal
W-SU
WET
Zulu
EST
HST
MST
ACT
AET
AGT
ART
AST
BET
BST
CAT
CNT
CST
CTT
EAT
ECT
IET
IST
JST
MIT
NET
NST
PLT
PNT
PRT
PST
SST
VST |
Examples
Timetable for a session that should start right after initialization of FEJ
The file with a session's parameters has the following name: s_fix_session1.properties
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<schedules xmlns="http://epam.com/fej/schedules">
<schedule id="session1">
<task name="start" onLoad="true"/>
</schedule>
</schedules> |
Timetable for a session that should start at 9 am and stop at 6 pm
The file with a session's parameters has the following name: s_fix_Exchange.properties
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<schedules xmlns="http://epam.com/fej/schedules">
<schedule id="Exchange">
<task name="start" timeZone="Europe/Samara">
<event cron="0 0 09 ? * *"/>
</task>
<task name="stop" timeZone="Europe/Samara">
<event cron="0 0 18 ? * *"/>
</task>
</schedule>
</schedules> |
Triggering routing rules by the scheduler
Scheduler configuration
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<schedule id="every10Seconds">
<task name="event" timeZone="Europe/Samara">
<event cron="*/10 * * ? * *"/>
</task>
</schedule> |
Rule configuration
Code Block |
---|
eventRule("Catching scheduler events", SchedulerEvent.class, {
appEvent -> return true//does nothing but there can be additional logic
},
{
schedulerEvent ->
logger.info("I'm rule for schedule events, id - {}.", schedulerEvent.getId())
}
) |
Routing Rules Configuration
FIX Edge Java provides an RoutingRule
unit as an abstraction for internal message routing element. FEJ supports pure Java and Groovy implementations for routing rules. Please find additional information in the article FIXEdge Java - Groovy rules
Logging configuration
FEJ uses Log4j 2 as a logging framework. Its configuration is stored in log4j2.xml
file. For more information about configuration please refer Log4j 2 official documentation.
Administrative shell configuration
...
Shell configuration properties are stored in shell.properties
file.
Name | Default value | Description |
---|---|---|
crash.auth | spring | Authentication mechanism |
crash.ssh.port | 2000 | SSH server port |
crash.ssh.auth_timeout | 300000 | Authentication timeout of the SSH server (in milliseconds) |
crash.ssh.idle_timeout | 300000 | Idle timeout of the SSH server (in milliseconds) |
crash.ssh.default_encoding | UTF-8 | Character encoding |
FEJ uses Java shell called ‘CRaSH’. For more information about it configuration properties please refer to the CRaSH reference documentation.
...