Table of Contents |
---|
Overview
FIXEdge/J provides a functionality for storing and forwarding messages functionality that messages are stored and forwarded in the event that when a connection with one of the counterparties is dropped and messages are not delivered. These messages will be stored by the queue and forwarded when the receiving counterparty connection is re-established. E.g. if For example, if one of the counterparties is logged off and messages are being sent, FIXEdge/J can place the undelivered messages into the Store & Forward Queue and route them once the counterparty is logged on. The
Store and Forward functionality:
- can be enabled/disabled for a particular session in the FIXEdge/J
- can be used for specific message types (business only)
- can be used for specific messages by specifying a particular filter with tags values, e.g. , for example, 59=0
- can define stale messages and remove them from the queue
- has persisting options - in the memory and on the disk
...
Enable Store and Forward functionality
Enable
...
Store and Forward queue for an endpoint
To enable a the Store and Forward queue for a particular endpoint, use the the property storeAndForwardEndpoint.enabled=true/false propertyfalse.
For example, Client A may want to store all business messages that he it sends to the Exchange. In this case, the Store and Forward queue should be enabled at on the destination, (Exchange), where he sends messages i.e. the Exchange where it sends to.
Code Block | ||||
---|---|---|---|---|
| ||||
sessionType=acceptor senderCompID=FIXEdgeJCompID targetCompID=Exchange storeAndForwardEndpoint.enabled=true |
Note.NOTE: To enable/disable the Store and Forward queue for all endpoints on FIXEdge/J, use the storeAndForwardEndpoint.enabled=true/false property in the sfalse property in s_fixDefault.properties.
Enable
...
Store and Forward functionality for
...
a session
To enable the Store and Forward queue for a particular session, use the the property storeAndForward.enabled=true/false propertyfalse.
For example, Client A may want to store all the business messages that he it sends to the Exchange. At the same time, Client B may not want to store the messages that he that it sends to the same Exchange. In this case, the Store and Forward functionality should be disabled for Client B.
...
storeAndForward.enabled=true | storeAndForward.enabled=false | |
---|---|---|
storeAndForwardEndpoint.enabled=true | Client A: storeAndForward.enabled=true Client B: storeAndForward.enabled=true Exchange: storeAndForwardEndpoint.enabled=true Messages from Client A and Client B will be stored in the Exchange 's Store and Forward queue. | Client A: storeAndForward.enabled=true Client B: storeAndForward.enabled=false Exchange: storeAndForwardEndpoint.enabled=true Messages from Client A will be stored in the Exchange 's Store and Forward queue. Messages from Client B will not be stored in the Exchange 's Store and Forward queue. |
Client A: storeAndForwardEndpoint.enabled=true Client B: storeAndForwardEndpoint.enabled=true Exchange: storeAndForward.enabled=true Messages from the Exchange will be stored in the Clients Client Store and Forward queuesqueue. | Client A: storeAndForwardEndpoint.enabled=true Client B: storeAndForwardEndpoint.enabled=true Exchange: storeAndForward.enabled=false Messages from the Exchange will not be stored in the Clients Client Store and Forward queuesqueue. | |
storeAndForwardEndpoint.enabled=false | Client A: storeAndForward.enabled=true Client B: storeAndForward.enabled=true Exchange: storeAndForwardEndpoint.enabled=false Messages from Client A and Client B will not be stored in the Exchange 's Store and Forward queue. | Client A: storeAndForward.enabled=true Client B: storeAndForward.enabled=false Exchange: storeAndForwardEndpoint.enabled=false Messages from Client A and Client B will not be stored in the Exchange 's Store and Forward queue. |
Client A: storeAndForwardEndpoint.enabled=true Client B: storeAndForwardEndpoint.enabled=false Exchange: storeAndForward.enabled=true Messages from the Exchange will be stored in the Client A Store and Forward queue. Messages from the Exchange will not be stored in the Client B Store and Forward queue. | Client A: storeAndForwardEndpoint.enabled=true Client B: storeAndForwardEndpoint.enabled=false Exchange: storeAndForward.enabled=false Messages from the Exchange will not be stored in the Clients Client Store and Forward queuesqueue. |
Configure Store and Forward for particular message types
To enable a the Store and Forward queue for particular message types, use the property storeAndForward.msgTypesRequiredForDelivery=F,G.
For example, Client A may only want to store only Order Cancel Request (MsgType = F) messages. In this case, a message type should to be specified for storage in the Store stored in the Store and Forward queue should be specified for a Client's session.
Code Block | ||||
---|---|---|---|---|
| ||||
sessionType=acceptor senderCompID=FIXEdgeJCompID targetCompID=ClientA groups=Group_A storeAndForward.enabled=true storeAndForward.msgTypesRequiredForDelivery=F |
...
Filtering messages by particular tag values can be configured using business rules. There is a special function, 'requiredForDelivery' , that function which enables message saving in the Store and Forward queue.
If the "requiredForDelivery" parameter is set to true or not defined, then the message will be saved and delivered regardlessin any case.
Code Block | ||||
---|---|---|---|---|
| ||||
... def requiredForDelivery = false if(msg.getTagValueAsDouble(44) > 1000 && msg.getTagValueAsString(55) == "AAPL") { requiredForDelivery = true } send(routingContext, messageContext, destination, requiredForDelivery) ... |
...
Method name | Description | Example |
---|---|---|
clear() | Removes all messages | |
Iterator<MessageEvent> iterator() | Iterates through all the elements in the queue | for (Iterator<MessageEvent> iterator = queue.iterator(); iterator.hasNext(); ) { |
isEmpty() | Returns true if the queue is empty | |
MessageEvent peek() | Gets the first element without removing it | |
remove(MessageEvent messageEvent) | Removes the specified message event | MessageEvent first = queue.peek(); |
Example of a rule for removing queued orders by cancel request
...