org.apache.synapse.transport.fix
public class: FIXTransportListener [javadoc |
source]
java.lang.Object
org.apache.synapse.transport.base.AbstractTransportListener
org.apache.synapse.transport.fix.FIXTransportListener
All Implemented Interfaces:
org.apache.axis2.transport.TransportListener
The FIX transport listener implementation. A FIX Transport Listner will hold
a FIX session factory, which would be created at initialization
time. This implementation supports the creation of FIX sessions at runtime
as and when required. This FIX Listener registers with Axis to be notified
of service deployment/undeployment/start/stop, and enables or disables
listening for FIX messages on the destinations as appropriate.
Service must state where the FIX configuration file is located so
that the required FIX sessions can be initialized for the service.
FIX configuration file should be a valid Quickfix/J session
configuration file. A URL to the file should be provided.
http://www.mycompany.org/fixconfig/file.cfg
Methods from org.apache.synapse.transport.base.AbstractTransportListener: |
---|
createMessageContext, destroy, disableTransportForService, getActiveThreadCount, getBytesReceived, getBytesSent, getEPRForService, getFaultsReceiving, getFaultsSending, getMessagesReceived, getMessagesSent, getMetricsCollector, getQueueSize, getSessionContext, getTransportName, handleException, handleIncomingMessage, init, logException, maintenenceShutdown, pause, resume, setTransportName, start, startListeningForService, stop, stopListeningForService |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.synapse.transport.fix.FIXTransportListener Detail: |
public EndpointReference[] getEPRsForService(String serviceName,
String ip) throws AxisFault {
//Try to get the list of EPRs from the FIXSessionFactory
String[] serviceEPRStrings = fixSessionFactory.getServiceEPRs(serviceName, ip);
if (serviceEPRStrings != null) {
EndpointReference[] serviceEPRs = new EndpointReference[serviceEPRStrings.length];
for (int i = 0; i < serviceEPRStrings.length; i++) {
serviceEPRs[i] = new EndpointReference(serviceEPRStrings[i]);
}
return serviceEPRs;
}
throw new AxisFault("Unable to get EPRs for the service " + serviceName);
}
Returns EPRs for the given service and IP over the FIX transport |
public void init(ConfigurationContext cfgCtx,
TransportInDescription trpInDesc) throws AxisFault {
setTransportName(FIXConstants.TRANSPORT_NAME);
super.init(cfgCtx, trpInDesc);
//initialize the FIXSessionFactory
fixSessionFactory = new FIXSessionFactory(new FIXApplicationFactory(this.cfgCtx, this.workerPool));
FIXTransportSender sender = (FIXTransportSender) cfgCtx.
getAxisConfiguration().getTransportOut(FIXConstants.TRANSPORT_NAME).getSender();
sender.setSessionFactory(fixSessionFactory);
log.info("FIX transport listener initialized...");
}
This is the TransportListener initialization method invoked by Axis2 |
protected void startListeningForService(AxisService service) {
if (service.getName().startsWith("__")) {
return;
}
fixSessionFactory.createFIXAcceptor(service);
}
Prepare to listen for FIX messages on behalf of the given service
by first creating and starting a FIX session |
protected void stopListeningForService(AxisService service) {
fixSessionFactory.disposeFIXAcceptor(service);
}
Stops listening for messages for the service thats undeployed or stopped
by stopping and disposing the appropriate FIX session |