org.apache.synapse.transport.fix
Class FIXSessionFactory

java.lang.Object
  extended by org.apache.synapse.transport.fix.FIXSessionFactory

public class FIXSessionFactory
extends Object

The FIXSessionFactory is responsible for creating and managing FIX sessions. A FIX session can be initiated in one of two modes, namely the acceptor mode and the initiator mode. FIX sessions requested by the transport listener at service deployment are created in acceptor mode. When the transport sender is about to send a FIX message it will check whether a valid FIX session exists. If not it will request the FIXSessionFactory to create a new session in the initiator mode.

To create a new FIX session (in either mode) the FIXSessionFactory has to create a LogFactory (nullable), and a MessageStoreFactroy. By default this implementation attempts to pass null as the LogFactory and a MemoryStoreFactory as the MessageStoreFactory. These can be configured in the services.xml as follows.

file (acceptable values: console, file, jdbc)

file (acceptable values: file, jdbc, memory, sleepycat)

The configuraion details related to these factories has to be specified in the FIX configuration file as requested by the Quickfix/J API.


Method Summary
 boolean createFIXAcceptor(AxisService service)
          Get the FIX configuration settings and initialize a new FIX session for the specified service.
 boolean createFIXInitiator(AxisService service)
           
 void createFIXInitiator(String fixEPR, AxisService service, quickfix.SessionID sessionID)
          Extract the parameters embedded in the given EPR and initialize a new FIX session.
 void disposeFIXAcceptor(AxisService service)
          Get the FIX Acceptor for the specified service from the sessionStore Map and stop it.
 void disposeFIXInitiators()
          Stops all the FIX initiators created so far and cleans up all the mappings related to them
 quickfix.Acceptor getAcceptor(String serviceName)
          Finds a FIX Acceptor for the specified service from the acceptorStore
 quickfix.Application getApplication(String fixEPR)
           
 quickfix.Initiator getInitiator(String fixEPR)
          Finds a FIX initiator for the specified EPR from the initiatorStore
static FIXSessionFactory getInstance(FIXApplicationFactory af)
           
 String[] getServiceEPRs(String serviceName, String ip)
          Returns an array of Strings representing EPRs for the specified service
 void setListenerThreadPool(org.apache.axis2.transport.base.threads.WorkerPool listenerThreadPool)
           
 void setSenderThreadPool(org.apache.axis2.transport.base.threads.WorkerPool senderThreadPool)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static FIXSessionFactory getInstance(FIXApplicationFactory af)

createFIXAcceptor

public boolean createFIXAcceptor(AxisService service)
                          throws AxisFault
Get the FIX configuration settings and initialize a new FIX session for the specified service. Create an Acceptor and a new FIX Application. Put the Acceptor into the acceptorStore keyed by the service name and start it.

Parameters:
service - the AxisService
Returns:
true if the acceptor is successfully initialized and false otherwise
Throws:
AxisFault - if the acceptor cannot be created

createFIXInitiator

public void createFIXInitiator(String fixEPR,
                               AxisService service,
                               quickfix.SessionID sessionID)
                        throws AxisFault
Extract the parameters embedded in the given EPR and initialize a new FIX session. Create a new FIX initiator and a new FIX Application.Put the initiator into the initiatorStore keyed by the EPR and start the initiator.

Parameters:
fixEPR - the EPR to send FIX messages
service - the AxisService
sessionID - the SessionID of the session created
Throws:
AxisFault - Exception thrown

createFIXInitiator

public boolean createFIXInitiator(AxisService service)
                           throws AxisFault
Throws:
AxisFault

disposeFIXAcceptor

public void disposeFIXAcceptor(AxisService service)
Get the FIX Acceptor for the specified service from the sessionStore Map and stop it. Then remove the Acceptor from the Map.

Parameters:
service - the AxisService

disposeFIXInitiators

public void disposeFIXInitiators()
Stops all the FIX initiators created so far and cleans up all the mappings related to them


getServiceEPRs

public String[] getServiceEPRs(String serviceName,
                               String ip)
Returns an array of Strings representing EPRs for the specified service

Parameters:
serviceName - the name of the service
ip - the IP address of the host
Returns:
an array of EPRs for the specified service

getAcceptor

public quickfix.Acceptor getAcceptor(String serviceName)
Finds a FIX Acceptor for the specified service from the acceptorStore

Parameters:
serviceName - the name of the AxisService
Returns:
a FIX Acceptor for the service

getInitiator

public quickfix.Initiator getInitiator(String fixEPR)
Finds a FIX initiator for the specified EPR from the initiatorStore

Parameters:
fixEPR - a valid FIX EPR
Returns:
a FIX initiator for the EPR

getApplication

public quickfix.Application getApplication(String fixEPR)

setListenerThreadPool

public void setListenerThreadPool(org.apache.axis2.transport.base.threads.WorkerPool listenerThreadPool)

setSenderThreadPool

public void setSenderThreadPool(org.apache.axis2.transport.base.threads.WorkerPool senderThreadPool)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.