You can use session InSeqNum and OutSeqNum properties to set the start sequence numbers before establishing the session.
Yes, you can have multiple session objects per engine instance.
Yes, all incoming events related to a particular session are sent from the same thread.
It is important to avoid time-consuming tasks inside session event handlers. Thus, you should fork a thread and listener can't be heavyweight.
The fields that start with the “Encoded” prefix should be used.
For example:
During message creation the following approach can be used:
39 40 41 42 | final String text = "string using local charset" ; final byte [] encodedText = text.getBytes(StandardCharsets.UTF_8); order.set(Tag.EncodedTextLen, encodedText.length); order.set(Tag.EncodedText, encodedText); |
During message processing the following approach can be used:
47 48 49 | final byte [] encodedText = order.getBytes(Tag.EncodedText); final String charset = "cp1251" ; final String text = new String(encodedText, charset); |
By default the FIX Engine automatically sets the SendingTime(52) field value to the current date and time using UTC+0 time zone.
This can be overridden in the session listener.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | public class SendingTimeModificator implements Session.OutboundApplicationMessageListener { public static void main(String[] args) { final Engine engine = Engine.init(); final Session session = new Session( "InitiatorCompId" , "AcceptorCompId" , Version.FIX50_SP2); session.setOutboundApplicationMessageListener( new SendingTimeModificator()); engine.shutdown(); } @Override public void onOutboundApplicationMessage(Object sender, Session.OutboundApplicationMessageArgs args) { final LocalDateTime sendingTime = ZonedDateTime.now(ZoneOffset.of( "UTC+5" )).toLocalDateTime(); final Message message = args.getMsg(); message.set(Tag.SendingTime, sendingTime); } } |
It means that the TCP connection was established and the initial Logon (MsgType=A) FIX message was sent, but after that the TCP connection was closed by the counterparty.
So we would recommend to contact your counterparty FIX support team and provide them with your FIX message log file (*.summary) and ask them what you need to change (if anything) in your initial Logon (MsgType=A) in order to establish the FIX session successfully.
Maybe they need to update the configuration settings on their side in order to accept your FIX connection (e.g. update login/password settings or the expected source IP address).
The recommended approach is:
For example, the CME has a restriction of not allowing client to ask for a resend span bigger than 2500 messages.
This can be achieved on the engine level:
29 30 31 | final EngineSettings settings = new EngineSettings(); settings.setSessionResendRequestMaximumRange( 2500 ); final Engine engine = Engine.init(settings); |
Or on the session level:
35 | session.setResendRequestMaximumRange( 2500 ); |
The reference tickets are: JAVA-648.
You can specify different tokens for the sessions with the same SenderCompID and TargetCompID.
Please see parameter token of the biz.onixs.fix.engine.Session.Session(String, String, Version, boolean, String) session constructor.
You should create corresponding dialect with the changed order of tags where “mode” of the messages set as “override”. Please see also Dialect docs section.