public class Session extends Object
Modifier and Type | Field and Description |
---|---|
static ErrorListener |
NULL_ERROR_LISTENER |
static InboundApplicationMessageListener |
NULL_INBOUND_APPLICATION_MESSAGE_LISTENER |
static InboundSessionMessageListener |
NULL_INBOUND_SESSION_MESSAGE_LISTENER |
static NotAppliedListener |
NULL_NOT_APPLIED_LISTENER |
static OutboundApplicationMessageListener |
NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER |
static OutboundSessionMessageListener |
NULL_OUTBOUND_SESSION_MESSAGE_LISTENER |
static WarningListener |
NULL_WARNING_LISTENER |
Constructor and Description |
---|
Session(long uuid,
SessionSettings settings) |
Session(long uuid,
SessionSettings settings,
boolean cleanStart,
SessionStorageType storageType) |
Session(long uuid,
SessionSettings settings,
int marketSegmentId,
boolean cleanStart,
SessionStorageType storageType) |
Session(SessionSettings settings) |
Session(SessionSettings settings,
int marketSegmentId) |
Session(SessionSettings settings,
int marketSegmentId,
boolean cleanStart,
SessionStorageType storageType) |
Modifier and Type | Method and Description |
---|---|
Session |
addStateChangeListener(StateChangeListener listener)
Adds state change listener.
|
Session |
breakConnection()
The socket is closed.
|
Session |
close() |
ByteDecoder |
getDecoder()
Returns SBE decoder class used by session to encode and decode SBE messages.
|
ErrorListener |
getErrorListener()
Returns error listener.
|
InboundApplicationMessageListener |
getInboundApplicationMessageListener()
Returns inbound application message listener.
|
InboundSessionMessageListener |
getInboundSessionMessageListener()
Returns inbound session message listener.
|
int |
getIncomingMessageGapQueueMaximumSize()
Returns maximum size of the incoming message gap queue.
|
long |
getInSeqNum() |
MessageSchema |
getMessageSchema()
Returns SBE templates description.
|
NotAppliedListener |
getNotAppliedListener()
Returns NotApplied listener.
|
OutboundApplicationMessageListener |
getOutboundApplicationMessageListener()
Returns outbound application message listener.
|
List<IMessage> |
getOutboundMessages(long beginSequenceNumber,
long endSequenceNumber)
Returns outbound messages with the specified sequence number interval.
|
OutboundSessionMessageListener |
getOutboundSessionMessageListener()
Returns outbound session message listener.
|
long |
getOutSeqNum() |
long |
getPreviousSeqNo() |
long |
getPreviousUuid() |
SessionId |
getSessionId() |
SessionSettings |
getSettings() |
SessionState |
getState()
Returns session state.
|
List<StateChangeListener> |
getStateChangeListeners()
Returns state change listeners.
|
SessionStorage |
getStorage()
Returns session storage.
|
boolean |
getValidateSequenceNumbers() |
WarningListener |
getWarningListener()
Returns warning listener.
|
boolean |
isClosed() |
boolean |
isSkipNegotiation()
Returns whether to skip negotiation.
|
Session |
logon(String host,
int port)
Establishes the connection.
|
Session |
removeStateChangeListener(StateChangeListener listener)
Removes state change listener.
|
Session |
reset(boolean startOfWeek)
Backups the current log files, resets the sequence numbers to 1 and generates a new UUID.
|
Session |
reset(boolean startOfWeek,
long uuid)
Backups the current log files, resets the sequence numbers to 1 and use specified new UUID.
|
Session |
send(IMessage message)
Sends SBE message.
|
Session |
sendRetransmissionRequest(long beginSeqNumber,
int numberOfMissedMsgs)
Sends the Retransmission Request message.
|
Session |
sendSequenceMessage(int keepAliveLapsed)
Send the Sequence message.
|
Session |
setErrorListener(ErrorListener listener)
Sets error listener.
|
Session |
setInboundApplicationMessageListener(InboundApplicationMessageListener listener)
Sets inbound application message listener.
|
Session |
setInboundSessionMessageListener(InboundSessionMessageListener listener)
Sets inbound session message listener.
|
Session |
setIncomingMessageGapQueueMaximumSize(int maxSize)
Sets maximum size of the incoming message gap queue.
|
Session |
setInSeqNum(long seqNum)
Sets the expected sequence number of the next incoming message.
|
Session |
setNotAppliedListener(NotAppliedListener listener)
Sets NotApplied listener.
|
Session |
setOutboundApplicationMessageListener(OutboundApplicationMessageListener listener)
Sets outbound application message listener.
|
Session |
setOutboundSessionMessageListener(OutboundSessionMessageListener listener)
Sets outbound session message listener.
|
Session |
setOutSeqNum(long seqNum)
Sets the expected sequence number of the next outgoing message.
|
Session |
setPreviousSeqNo(long seqNo) |
Session |
setPreviousUuid(long uuid) |
Session |
setSkipNegotiation(boolean negotiated)
Sets whether to skip negotiation.
|
Session |
setValidateSequenceNumbers(boolean value) |
Session |
setWarningListener(WarningListener listener)
Sets warning listener.
|
Session |
terminate()
Terminates the connection.
|
String |
toString() |
Session |
warmUp(IMessage message)
Warms up the sending path.
|
public static final WarningListener NULL_WARNING_LISTENER
public static final ErrorListener NULL_ERROR_LISTENER
public static final OutboundApplicationMessageListener NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER
public static final InboundApplicationMessageListener NULL_INBOUND_APPLICATION_MESSAGE_LISTENER
public static final OutboundSessionMessageListener NULL_OUTBOUND_SESSION_MESSAGE_LISTENER
public static final InboundSessionMessageListener NULL_INBOUND_SESSION_MESSAGE_LISTENER
public static final NotAppliedListener NULL_NOT_APPLIED_LISTENER
public Session(SessionSettings settings)
public Session(long uuid, SessionSettings settings)
public Session(long uuid, SessionSettings settings, boolean cleanStart, SessionStorageType storageType)
public Session(SessionSettings settings, int marketSegmentId)
public Session(SessionSettings settings, int marketSegmentId, boolean cleanStart, SessionStorageType storageType)
public Session(long uuid, SessionSettings settings, int marketSegmentId, boolean cleanStart, SessionStorageType storageType)
public Session logon(String host, int port)
host
- Market Gateway hostport
- Market Gateway portpublic Session terminate()
public Session breakConnection()
SessionState.TERMINATED
.
Breaks the FIX connection non-gracefully (without the exchange of Terminate messages).public Session reset(boolean startOfWeek)
Warning: Can be called only when the session is terminated.
startOfWeek
- if true
then the PreviousUUID and PreviousSeqNum are reset to 0.public Session reset(boolean startOfWeek, long uuid)
Warning: Can be called only when the session is terminated.
startOfWeek
- if true
then the PreviousUUID and PreviousSeqNum are reset to 0.uuid
- user generated UUID.public Session warmUp(IMessage message)
message
- SBE message to warm up the sending path.public Session send(IMessage message)
message
- SBE message.public Session sendSequenceMessage(int keepAliveLapsed)
Note: The session sends Sequence messages automatically per the CME iLink protocol. This method should be used only if an ad hoc Sequence message is required and the connection is established.
keepAliveLapsed
- Indicates whether one Keep Alive interval has lapsed without any message received.public Session sendRetransmissionRequest(long beginSeqNumber, int numberOfMissedMsgs)
Note: Normally, "Retransmission Request" message is sent automatically. This method allows to simulate a sequence gap by sending this message manually.
beginSeqNumber
- begin sequence number of the first requested message in the range.numberOfMissedMsgs
- the number of messages to be requested.IllegalArgumentException
- if (beginSeqNumber + numberOfMissedMsgs > inSeqNum)
or if
(numberOfMissedMsgs <= 0)
public SessionId getSessionId()
public SessionSettings getSettings()
public SessionState getState()
public ByteDecoder getDecoder()
public MessageSchema getMessageSchema()
public SessionStorage getStorage()
public OutboundApplicationMessageListener getOutboundApplicationMessageListener()
public Session setOutboundApplicationMessageListener(OutboundApplicationMessageListener listener)
listener
- outbound application message listener or NULL_OUTBOUND_APPLICATION_MESSAGE_LISTENER
value to reset listener to defaultpublic InboundApplicationMessageListener getInboundApplicationMessageListener()
public Session setInboundApplicationMessageListener(InboundApplicationMessageListener listener)
listener
- inbound application message listener or
NULL_INBOUND_APPLICATION_MESSAGE_LISTENER
value to reset listener to defaultpublic OutboundSessionMessageListener getOutboundSessionMessageListener()
public Session setOutboundSessionMessageListener(OutboundSessionMessageListener listener)
listener
- outbound session message listener or NULL_OUTBOUND_SESSION_MESSAGE_LISTENER
value
to reset listener to defaultpublic InboundSessionMessageListener getInboundSessionMessageListener()
public Session setInboundSessionMessageListener(InboundSessionMessageListener listener)
listener
- inbound session message listener or NULL_INBOUND_SESSION_MESSAGE_LISTENER
value to reset listener to defaultpublic NotAppliedListener getNotAppliedListener()
public Session setNotAppliedListener(NotAppliedListener listener)
listener
- NotApplied listener or NULL_NOT_APPLIED_LISTENER
value to reset listener to defaultpublic ErrorListener getErrorListener()
public Session setErrorListener(ErrorListener listener)
listener
- error listener or NULL_ERROR_LISTENER
value to reset listener to defaultpublic WarningListener getWarningListener()
public Session setWarningListener(WarningListener listener)
listener
- warning listener or NULL_WARNING_LISTENER
value to reset listener to defaultpublic List<StateChangeListener> getStateChangeListeners()
public Session addStateChangeListener(StateChangeListener listener)
listener
- state change listenerpublic Session removeStateChangeListener(StateChangeListener listener)
listener
- state change listenerpublic Session close()
public boolean isClosed()
public boolean isSkipNegotiation()
true
if the session is negotiated and it will be skipped (the Negotiation Response message has
been received in reply to the Negotiation message), otherwise - false
.public Session setSkipNegotiation(boolean negotiated)
negotiated
- true
if the session is negotiated and it will be skipped, otherwise - false
.public long getInSeqNum()
public Session setInSeqNum(long seqNum)
seqNum
- sequence numberpublic long getOutSeqNum()
public Session setOutSeqNum(long seqNum)
seqNum
- sequence numberpublic long getPreviousSeqNo()
public Session setPreviousSeqNo(long seqNo)
public long getPreviousUuid()
public Session setPreviousUuid(long uuid)
public int getIncomingMessageGapQueueMaximumSize()
public Session setIncomingMessageGapQueueMaximumSize(int maxSize)
maxSize
- maximum size of the incoming message gap queuepublic List<IMessage> getOutboundMessages(long beginSequenceNumber, long endSequenceNumber)
beginSequenceNumber
- sequence number to begin withendSequenceNumber
- sequence number to end withIllegalArgumentException
- if (beginSeqNum < 1)
public boolean getValidateSequenceNumbers()
public Session setValidateSequenceNumbers(boolean value)
Copyright © 2005–2024 Onix Solutions. All rights reserved.