Package quickfix

Examples of quickfix.Message


            this.password = password;
        }

        public void inject(Exchange exchange) throws CamelExchangeException {
            LOG.info("Injecting password into outgoing logon message");
            Message message = exchange.getIn().getMandatoryBody(Message.class);
            message.setString(RawData.FIELD, password);
            message.setInt(RawDataLength.FIELD, password.length());
        }
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

            message = message.substring(0, message.length() - 2);
        } else if (message.endsWith("\r") || message.endsWith("\n")) {
            message = message.substring(0, message.length() - 1);
        }

        return new Message(message, dataDictionary, false);
    }
View Full Code Here

            exchange.setException(e);
        }
    }

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

        SessionID messageSessionID = getEndpoint().getSessionID();
        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()) {
            MessageCorrelator messageCorrelator = getEndpoint().getEngine().getMessageCorrelator();
            callable = messageCorrelator.getReply(getEndpoint().getSessionID(), exchange);
        }

        if (!session.send(message)) {
            throw new CannotSendException("Cannot send FIX message: " + message.toString());
        }

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

    public FixMessageRouter(String engineUri) {
        this.engineUri = engineUri;
    }
   
    public String route(Exchange exchange) {
        Message message = exchange.getIn().getBody(Message.class);
        if (message != null) {
            SessionID destinationSession = getDestinationSessionID(message);
            if (destinationSession != null) {
                String destinationUri = String.format("%s?sessionID=%s", engineUri, destinationSession);
                LOG.debug("Routing destination: {}", destinationUri);
View Full Code Here

    @Test
    public void convertToExchange() {
        SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
        QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", camelContext);
       
        Message message = new Message();    
        message.getHeader().setString(MsgType.FIELD, MsgType.ORDER_SINGLE);
       
        Exchange exchange = QuickfixjConverters.toExchange(endpoint, sessionID, message, QuickfixjEventCategory.AppMessageSent);
       
        assertThat((SessionID)exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY), is(sessionID));
       
View Full Code Here

            Exchange exchange = new DefaultExchange(camelContext);
            exchange.getIn().setHeader(QuickfixjEndpoint.SESSION_ID_KEY, sessionID);
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
View Full Code Here

            Exchange exchange = new DefaultExchange(camelContext);
            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, new DataDictionary("FIX44.xml"));
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
View Full Code Here

            Exchange exchange = new DefaultExchange(camelContext);
            exchange.setProperty(QuickfixjEndpoint.DATA_DICTIONARY_KEY, "FIX44.xml");
            exchange.getIn().setBody(data);
           
            Message message = exchange.getIn().getBody(Message.class);
           
            NoHops hop = new NoHops();
            message.getHeader().getGroup(1, hop);
            assertEquals("FOO", hop.getString(HopCompID.FIELD));
            message.getHeader().getGroup(2, hop);
            assertEquals("BAR", hop.getString(HopCompID.FIELD));

        } finally {
            quickfixjEngine.stop();
        }
View Full Code Here

    }
   
    public static class LogonAuthenticator {
        public void authenticate(Exchange exchange) throws RejectLogon, InvalidPayloadException, FieldNotFound {
            LOG.info("Acceptor is rejecting logon for " + exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY));
            Message message = ExchangeHelper.getMandatoryInBody(exchange, Message.class);
            if (message.isSetField(RawData.FIELD)) {
                LOG.info("Invalid password: " + message.getString(RawData.FIELD));
            }
            throw new RejectLogon("Rejecting logon for test purposes");
        }
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.