/** * Send a message to the session specified by the provided session ID. * * @param message a FIX message * @param sessionID the target SessionID * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, SessionID sessionID) throws SessionNotFound { final Session session = lookupSession(sessionID); if (session == null) { throw new SessionNotFound(); } message.setSessionID(sessionID); return session.send(message); }
@Override public void next(Trade trade) { try { sendExecutionReport(trade, new Side(Side.BUY)); sendExecutionReport(trade, new Side(Side.SELL)); } catch (SessionNotFound sessionNotFound) { logger.error(sessionNotFound.getMessage(), sessionNotFound); } }
private void sendMessage(SessionID sessionID, Message message) { try { Session session = Session.lookupSession(sessionID); if (session == null) { throw new SessionNotFound(sessionID.toString()); } DataDictionaryProvider dataDictionaryProvider = session.getDataDictionaryProvider(); if (dataDictionaryProvider != null) { try { dataDictionaryProvider.getApplicationDataDictionary( getApplVerID(session, message)).validate(message, true); } catch (Exception e) { LogUtil.logThrowable(sessionID, "Outgoing message failed validation: " + e.getMessage(), e); return; } } session.send(message); } catch (SessionNotFound e) { log.error(e.getMessage(), e); } }
private void rejectOrder(String senderCompId, String targetCompId, String clOrdId, String symbol, char side, String message) { ExecutionReport fixOrder = new ExecutionReport(new OrderID(clOrdId), new ExecID(generator .genExecutionID()), new ExecTransType(ExecTransType.NEW), new ExecType( ExecType.REJECTED), new OrdStatus(ExecType.REJECTED), new Symbol(symbol), new Side( side), new LeavesQty(0), new CumQty(0), new AvgPx(0)); fixOrder.setString(ClOrdID.FIELD, clOrdId); fixOrder.setString(Text.FIELD, message); fixOrder.setInt(OrdRejReason.FIELD, OrdRejReason.BROKER_EXCHANGE_OPTION); try { Session.sendToTarget(fixOrder, senderCompId, targetCompId); } catch (SessionNotFound e) { e.printStackTrace(); } }
/** * Send a message to the session specified by the provided session ID. * * @param message a FIX message * @param sessionID the target SessionID * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, SessionID sessionID) throws SessionNotFound { final Session session = lookupSession(sessionID); if (session == null) { throw new SessionNotFound(); } message.setSessionID(sessionID); return session.send(message); }
logger.error(configError.getMessage(), configError); } catch (SessionNotFound sessionNotFound) { logger.error(sessionNotFound.getMessage(), sessionNotFound);
/** * Send a message to the session specified by the provided session ID. * * @param message a FIX message * @param sessionID the target SessionID * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, SessionID sessionID) throws SessionNotFound { final Session session = lookupSession(sessionID); if (session == null) { throw new SessionNotFound(); } message.setSessionID(sessionID); return session.send(message); }
/** * Send a message to the session specified in the message's target * identifiers. The session qualifier is used to distinguish sessions with * the same target identifiers. * * @param message a FIX message * @param qualifier a session qualifier * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, String qualifier) throws SessionNotFound { try { final String senderCompID = getSenderCompIDFromMessage(message); final String targetCompID = getTargetCompIDFromMessage(message); return sendToTarget(message, senderCompID, targetCompID, qualifier); } catch (final FieldNotFound e) { throw new SessionNotFound("missing sender or target company ID"); } }
/** * Send a message to the session specified in the message's target * identifiers. The session qualifier is used to distinguish sessions with * the same target identifiers. * * @param message a FIX message * @param qualifier a session qualifier * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, String qualifier) throws SessionNotFound { try { final String senderCompID = getSenderCompIDFromMessage(message); final String targetCompID = getTargetCompIDFromMessage(message); return sendToTarget(message, senderCompID, targetCompID, qualifier); } catch (final FieldNotFound e) { throw new SessionNotFound("missing sender or target company ID"); } }
/** * Send a message to the session specified in the message's target * identifiers. The session qualifier is used to distinguish sessions with * the same target identifiers. * * @param message a FIX message * @param qualifier a session qualifier * @return true is send was successful, false otherwise * @throws SessionNotFound if session could not be located */ public static boolean sendToTarget(Message message, String qualifier) throws SessionNotFound { try { final String senderCompID = message.getHeader().getString(SenderCompID.FIELD); final String targetCompID = message.getHeader().getString(TargetCompID.FIELD); return sendToTarget(message, senderCompID, targetCompID, qualifier); } catch (final FieldNotFound e) { throw new SessionNotFound("missing sender or target company ID"); } }