Search in sources :

Example 1 with SessionNotFound

use of quickfix.SessionNotFound in project camel by apache.

the class TradeExecutor method sendMessage.

private void sendMessage(SessionID sessionID, Message message) {
    try {
        Session session = Session.lookupSession(sessionID);
        if (session == null) {
            throw new SessionNotFound(sessionID.toString());
        }
        DataDictionaryProvider provider = session.getDataDictionaryProvider();
        if (provider != null) {
            try {
                ApplVerID applVerID = getApplVerID(session, message);
                DataDictionary appDataDictionary = provider.getApplicationDataDictionary(applVerID);
                appDataDictionary.validate(message, true);
            } catch (Exception e) {
                LogUtil.logThrowable(sessionID, "Outgoing message failed validation: " + e.getMessage(), e);
                return;
            }
        }
        for (QuickfixjMessageListener listener : listeners) {
            try {
                listener.onMessage(sessionID, message);
            } catch (Throwable e) {
                LogUtil.logThrowable(sessionID, "Error while dispatching message", e);
            }
        }
    } catch (SessionNotFound e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ApplVerID(quickfix.field.ApplVerID) DataDictionary(quickfix.DataDictionary) DataDictionaryProvider(quickfix.DataDictionaryProvider) Session(quickfix.Session) SessionNotFound(quickfix.SessionNotFound)

Aggregations

DataDictionary (quickfix.DataDictionary)1 DataDictionaryProvider (quickfix.DataDictionaryProvider)1 Session (quickfix.Session)1 SessionNotFound (quickfix.SessionNotFound)1 ApplVerID (quickfix.field.ApplVerID)1