Package quickfix

Examples of quickfix.Message


    getCache().lock();

    try {
      if (!getCache().contains(AbstractQuickFIXMessage.this)) {
        try {
          Message message = new Message(new String(getBytes()), dictionary, false);

          getCache().put(this, message);

          if (getDictionary() == null) {
            setDictionary(QuickFIXUtils.getDictionary(message));
View Full Code Here


  private static final Logger log = Logger.getLogger(AbstractQuickFIXMessage.class);

  class MyDecoderOutput implements ProtocolDecoderOutput {
    public void write(Object object) {
      try {
        getCache().put(AbstractQuickFIXMessage.this, new Message((String) object));
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);

        throw new HermesRuntimeException(ex);
      }
View Full Code Here

        mockExchange = Mockito.mock(Exchange.class);
        org.apache.camel.Message mockCamelMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getIn()).thenReturn(mockCamelMessage);
       
        inboundFixMessage = new Message();
        inboundFixMessage.getHeader().setString(BeginString.FIELD, FixVersions.BEGINSTRING_FIX44);
        inboundFixMessage.getHeader().setString(SenderCompID.FIELD, "SENDER");
        inboundFixMessage.getHeader().setString(TargetCompID.FIELD, "TARGET");
        sessionID = MessageUtils.getSessionID(inboundFixMessage);
        Mockito.when(mockCamelMessage.getBody(quickfix.Message.class)).thenReturn(inboundFixMessage);
View Full Code Here

    public void setExceptionOnInOutExchange() throws Exception {           
        org.apache.camel.Message mockCamelOutMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOut);
        Mockito.when(mockExchange.hasOut()).thenReturn(true);
        Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
        Mockito.when(mockCamelOutMessage.getBody(Message.class)).thenReturn(new Message());
       
        QuickfixjConsumer consumer = new QuickfixjConsumer(mockEndpoint, mockProcessor);
        consumer.start();
       
        // Simulate a message from the FIX engine
View Full Code Here

    @Test
    public void processInOutExchange() throws Exception {
        org.apache.camel.Message mockCamelOutMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.hasOut()).thenReturn(true);
        Mockito.when(mockExchange.getOut()).thenReturn(mockCamelOutMessage);
        Message outboundFixMessage = new Message();
        Mockito.when(mockCamelOutMessage.getBody(Message.class)).thenReturn(outboundFixMessage);
       
        QuickfixjConsumer consumer = Mockito.spy(new QuickfixjConsumer(mockEndpoint, mockProcessor));
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(consumer).getSession(MessageUtils.getReverseSessionID(inboundFixMessage));
View Full Code Here

    }
   
    @Converter
    public static Message toMessage(String value, Exchange exchange) throws InvalidMessage, ConfigError {
        DataDictionary dataDictionary = getDataDictionary(exchange);
        return new Message(value, dataDictionary);
    }
View Full Code Here

        Mockito.when(mockExchange.getPattern()).thenReturn(ExchangePattern.InOnly);
       
        quickfixjEngine = TestSupport.createEngine();
        Mockito.when(mockEndpoint.getEngine()).thenReturn(quickfixjEngine);
       
        inboundFixMessage = new Message();
        inboundFixMessage.getHeader().setString(BeginString.FIELD, FixVersions.BEGINSTRING_FIX44);
        inboundFixMessage.getHeader().setString(SenderCompID.FIELD, "SENDER");
        inboundFixMessage.getHeader().setString(TargetCompID.FIELD, "TARGET");
        sessionID = MessageUtils.getSessionID(inboundFixMessage);
  
View Full Code Here

            1000L, Long.class)).thenReturn(5000L);
               
        org.apache.camel.Message mockOutboundCamelMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getOut()).thenReturn(mockOutboundCamelMessage);
       
        final Message outboundFixMessage = new Email();
        outboundFixMessage.getHeader().setString(SenderCompID.FIELD, "TARGET");
        outboundFixMessage.getHeader().setString(TargetCompID.FIELD, "SENDER");
       
        Session mockSession = Mockito.spy(TestSupport.createSession(sessionID));
        Mockito.doReturn(mockSession).when(producer).getSession(MessageUtils.getSessionID(inboundFixMessage));
        Mockito.doAnswer(new Answer<Boolean>() {
            @Override
View Full Code Here

        sendMessage(exchange, exchange.getIn());
    }

    void sendMessage(Exchange exchange, org.apache.camel.Message camelMessage) throws InterruptedException {
        try {
            Message message = camelMessage.getBody(Message.class);
            log.debug("Sending FIX message: {}", message);

            SessionID messageSessionID = sessionID;
            if (messageSessionID == null) {
                messageSessionID = MessageUtils.getSessionID(message);
            }

            Session session = getSession(messageSessionID);
            if (session == null) {
                throw new IllegalStateException("Unknown session: " + messageSessionID);
            }

            Callable<Message> callable = null;

            if (exchange.getPattern().isOutCapable()) {
                QuickfixjEndpoint endpoint = (QuickfixjEndpoint) getEndpoint();
                MessageCorrelator messageCorrelator = endpoint.getEngine().getMessageCorrelator();
                callable = messageCorrelator.getReply(endpoint.getSessionID(), exchange);
            }

            session.send(message);

            if (callable != null) {
                Message reply = callable.call();
                exchange.getOut().setBody(reply);
            }
        } catch (Exception e) {
            exchange.setException(e);
        }
View Full Code Here

        mockExchange = Mockito.mock(Exchange.class);
        org.apache.camel.Message mockCamelMessage = Mockito.mock(org.apache.camel.Message.class);
        Mockito.when(mockExchange.getIn()).thenReturn(mockCamelMessage);
       
        inboundFixMessage = new Message();
        inboundFixMessage.getHeader().setString(BeginString.FIELD, FixVersions.BEGINSTRING_FIX44);
        inboundFixMessage.getHeader().setString(SenderCompID.FIELD, "SENDER");
        inboundFixMessage.getHeader().setString(TargetCompID.FIELD, "TARGET");
        Mockito.when(mockCamelMessage.getBody(quickfix.Message.class)).thenReturn(inboundFixMessage);
       
View Full Code Here

TOP

Related Classes of quickfix.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.