Search in sources :

Example 1 with MsgType

use of quickfix.field.MsgType in project wso2-synapse by wso2.

the class FIXIncomingMessageHandler method toApp.

/**
 * This is a callback for application messages that are being sent to a
 * counter party.
 *
 * @param message   QuickFIX message
 * @param sessionID QuickFIX session ID
 * @throws DoNotSend This exception aborts message transmission
 */
public void toApp(Message message, SessionID sessionID) throws DoNotSend {
    if (log.isDebugEnabled()) {
        StringBuffer sb = new StringBuffer();
        try {
            sb.append("Sending application level FIX message to ").append(message.getHeader().getField(new TargetCompID()).getValue());
            sb.append("\nMessage Type: ").append(message.getHeader().getField(new MsgType()).getValue());
            sb.append("\nMessage Sequence Number: ").append(message.getHeader().getField(new MsgSeqNum()).getValue());
            sb.append("\nSender ID: ").append(message.getHeader().getField(new SenderCompID()).getValue());
        } catch (FieldNotFound e) {
            sb.append("Sending application level FIX message...");
            log.warn("One or more required fields are not found in the response message", e);
        }
        log.debug(sb.toString());
        if (log.isTraceEnabled()) {
            log.trace("Message: " + message.toString());
        }
    }
    if (eventHandler != null) {
        eventHandler.toApp(this, message, sessionID);
    }
}
Also used : SenderCompID(quickfix.field.SenderCompID) TargetCompID(quickfix.field.TargetCompID) MsgType(quickfix.field.MsgType) MsgSeqNum(quickfix.field.MsgSeqNum)

Example 2 with MsgType

use of quickfix.field.MsgType in project wso2-synapse by wso2.

the class FIXIncomingMessageHandler method fromAdmin.

/**
 * This callback notifies when an administrative message is sent from a
 * counterparty to the FIX engine.
 *
 * @param message   QuickFIX message
 * @param sessionID QuickFIX session ID
 * @throws FieldNotFound
 * @throws IncorrectDataFormat
 * @throws IncorrectTagValue
 * @throws RejectLogon         causes a logon reject
 */
public void fromAdmin(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {
    if (log.isDebugEnabled()) {
        StringBuffer sb = new StringBuffer();
        sb.append("Received admin level FIX message from ").append(message.getHeader().getField(new SenderCompID()).getValue());
        sb.append("\nMessage Type: ").append(message.getHeader().getField(new MsgType()).getValue());
        sb.append("\nMessage Sequence Number: ").append(message.getHeader().getField(new MsgSeqNum()).getValue());
        sb.append("\nReceiver ID: ").append(message.getHeader().getField(new TargetCompID()).getValue());
        log.debug(sb.toString());
        if (log.isTraceEnabled()) {
            log.trace("Message: " + message.toString());
        }
    }
    if (eventHandler != null) {
        eventHandler.fromAdmin(this, message, sessionID);
    }
}
Also used : SenderCompID(quickfix.field.SenderCompID) TargetCompID(quickfix.field.TargetCompID) MsgType(quickfix.field.MsgType) MsgSeqNum(quickfix.field.MsgSeqNum)

Example 3 with MsgType

use of quickfix.field.MsgType in project wso2-synapse by wso2.

the class FIXIncomingMessageHandlerTest method testFromAdmin.

@Test
public void testFromAdmin() throws Exception {
    SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("SYNAPSE"), new TargetCompID("BANZAI"), "FIX.4.1:SYNAPSE->BANZAI");
    Message message = new NewOrderSingle();
    message.getHeader().setField(new BeginString("FIX.4.1"));
    message.getHeader().setField(new SenderCompID("SYNAPSE"));
    message.getHeader().setField(new TargetCompID("BANZAI"));
    message.getHeader().setField(new MsgSeqNum(1));
    message.getHeader().setField(new MsgType("A"));
    ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
    WorkerPool pool = new NativeWorkerPool(3, 4, 10, 10, "name", "id");
    FIXIncomingMessageHandler handler = new FIXIncomingMessageHandler(cfgCtx, pool, service, true);
    handler.fromAdmin(message, id);
}
Also used : NewOrderSingle(quickfix.fix41.NewOrderSingle) BeginString(quickfix.field.BeginString) SenderCompID(quickfix.field.SenderCompID) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Message(quickfix.Message) TargetCompID(quickfix.field.TargetCompID) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) MsgType(quickfix.field.MsgType) MsgSeqNum(quickfix.field.MsgSeqNum) WorkerPool(org.apache.axis2.transport.base.threads.WorkerPool) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) SessionID(quickfix.SessionID) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with MsgType

use of quickfix.field.MsgType in project wso2-synapse by wso2.

the class FIXIncomingMessageHandlerTest method testToAdmin.

@Test
public void testToAdmin() throws Exception {
    initMocks(this);
    SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("SYNAPSE"), new TargetCompID("BANZAI"), "FIX.4.1:SYNAPSE->BANZAI");
    Message message = new NewOrderSingle();
    message.getHeader().setField(new BeginString("FIX.4.1"));
    message.getHeader().setField(new SenderCompID("SYNAPSE"));
    message.getHeader().setField(new TargetCompID("BANZAI"));
    message.getHeader().setField(new MsgSeqNum(1));
    message.getHeader().setField(new MsgType("A"));
    PowerMockito.when(service.getParameter(FIXConstants.FIX_USERNAME)).thenReturn(new Parameter(FIXConstants.FIX_USERNAME, "wos2"));
    PowerMockito.when(service.getParameter(FIXConstants.FIX_PASSWORD)).thenReturn(new Parameter(FIXConstants.FIX_PASSWORD, "wos2"));
    ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
    WorkerPool pool = new NativeWorkerPool(3, 4, 10, 10, "name", "id");
    FIXIncomingMessageHandler handler = new FIXIncomingMessageHandler(cfgCtx, pool, service, true);
    handler.toAdmin(message, id);
}
Also used : NewOrderSingle(quickfix.fix41.NewOrderSingle) BeginString(quickfix.field.BeginString) SenderCompID(quickfix.field.SenderCompID) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Message(quickfix.Message) TargetCompID(quickfix.field.TargetCompID) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) MsgType(quickfix.field.MsgType) MsgSeqNum(quickfix.field.MsgSeqNum) WorkerPool(org.apache.axis2.transport.base.threads.WorkerPool) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) Parameter(org.apache.axis2.description.Parameter) SessionID(quickfix.SessionID) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with MsgType

use of quickfix.field.MsgType in project wso2-synapse by wso2.

the class FIXIncomingMessageHandlerTest method testToApp.

@Test
public void testToApp() throws Exception {
    SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("SYNAPSE"), new TargetCompID("BANZAI"), "FIX.4.1:SYNAPSE->BANZAI");
    Message message = new NewOrderSingle();
    message.getHeader().setField(new BeginString("FIX.4.1"));
    message.getHeader().setField(new SenderCompID("SYNAPSE"));
    message.getHeader().setField(new TargetCompID("BANZAI"));
    message.getHeader().setField(new MsgSeqNum(1));
    message.getHeader().setField(new MsgType("A"));
    ConfigurationContext cfgCtx = new ConfigurationContext(new AxisConfiguration());
    WorkerPool pool = new NativeWorkerPool(3, 4, 10, 10, "name", "id");
    FIXIncomingMessageHandler handler = new FIXIncomingMessageHandler(cfgCtx, pool, service, true);
    handler.toApp(message, id);
}
Also used : NewOrderSingle(quickfix.fix41.NewOrderSingle) BeginString(quickfix.field.BeginString) SenderCompID(quickfix.field.SenderCompID) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) Message(quickfix.Message) TargetCompID(quickfix.field.TargetCompID) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) MsgType(quickfix.field.MsgType) MsgSeqNum(quickfix.field.MsgSeqNum) WorkerPool(org.apache.axis2.transport.base.threads.WorkerPool) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) SessionID(quickfix.SessionID) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

MsgSeqNum (quickfix.field.MsgSeqNum)6 MsgType (quickfix.field.MsgType)6 SenderCompID (quickfix.field.SenderCompID)6 TargetCompID (quickfix.field.TargetCompID)6 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)3 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)3 NativeWorkerPool (org.apache.axis2.transport.base.threads.NativeWorkerPool)3 WorkerPool (org.apache.axis2.transport.base.threads.WorkerPool)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 Message (quickfix.Message)3 SessionID (quickfix.SessionID)3 BeginString (quickfix.field.BeginString)3 NewOrderSingle (quickfix.fix41.NewOrderSingle)3 Parameter (org.apache.axis2.description.Parameter)2