• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MsgType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中quickfix.field.MsgType的典型用法代码示例。如果您正苦于以下问题:Java MsgType类的具体用法?Java MsgType怎么用?Java MsgType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MsgType类属于quickfix.field包,在下文中一共展示了MsgType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: transform

import quickfix.field.MsgType; //导入依赖的package包/类
public void transform(Exchange exchange) throws FieldNotFound {
    // For the reply take the reverse sessionID into the account, see org.apache.camel.component.quickfixj.MessagePredicate
    String requestSessionID = exchange.getIn().getHeader("sessionID", String.class);
    String replySessionID = "FIX.4.2:MARKET->TRADER";
    LOG.info("Given the requestSessionID '{}' calculated the replySessionID as '{}'", requestSessionID, replySessionID);

    String orderID = exchange.getIn().getHeader("orderID", String.class);

    OrderStatusRequest request = new OrderStatusRequest(new ClOrdID("XYZ"), new Symbol("GOOG"), new Side(Side.BUY));
    request.set(new OrderID(orderID));
     
    // Look for a reply execution report back to the requester session
    // and having the requested OrderID. This is a loose correlation but the best
    // we can do with FIX 4.2. Newer versions of FIX have an optional explicit correlation field.
    exchange.setProperty(QuickfixjProducer.CORRELATION_CRITERIA_KEY, new MessagePredicate(
        new SessionID(replySessionID), MsgType.EXECUTION_REPORT).withField(OrderID.FIELD, request.getString(OrderID.FIELD)));
    
    exchange.getIn().setBody(request);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:RequestReplyExample.java


示例2: toExchange

import quickfix.field.MsgType; //导入依赖的package包/类
public static Exchange toExchange(Endpoint endpoint, SessionID sessionID, Message message, QuickfixjEventCategory eventCategory, ExchangePattern exchangePattern) {
    Exchange exchange = endpoint.createExchange(exchangePattern);

    org.apache.camel.Message camelMessage = exchange.getIn();
    camelMessage.setHeader(EVENT_CATEGORY_KEY, eventCategory);
    camelMessage.setHeader(SESSION_ID_KEY, sessionID);

    if (message != null) {
        try {
            camelMessage.setHeader(MESSAGE_TYPE_KEY, message.getHeader().getString(MsgType.FIELD));
        } catch (FieldNotFound e) {
            LOG.warn("Message type field not found in QFJ message: {}, continuing...", message);
        }
    }
    camelMessage.setBody(message);

    return exchange;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:QuickfixjConverters.java


示例3: convertToExchange

import quickfix.field.MsgType; //导入依赖的package包/类
@Test
public void convertToExchange() {
    SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
    QuickfixjEndpoint endpoint = new QuickfixjEndpoint(null, "", new QuickfixjComponent());
    
    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));
    
    assertThat((QuickfixjEventCategory)exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY), 
            is(QuickfixjEventCategory.AppMessageSent));
    
    assertThat((String)exchange.getIn().getHeader(QuickfixjEndpoint.MESSAGE_TYPE_KEY), is(MsgType.ORDER_SINGLE));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:QuickfixjConvertersTest.java


示例4: generateSequenceReset

import quickfix.field.MsgType; //导入依赖的package包/类
/**
 *
 * @param receivedMessage if not null, it is the message received and upon which the resend request is generated
 * @param beginSeqNo
 * @param endSeqNo
 * @throws FieldNotFound
 */
private void generateSequenceReset(Message receivedMessage, int beginSeqNo, int endSeqNo)
        throws FieldNotFound {
    final Message sequenceReset = messageFactory.create(sessionID.getBeginString(),
            MsgType.SEQUENCE_RESET);
    final int newSeqNo = endSeqNo;
    final Header header = sequenceReset.getHeader();
    header.setBoolean(PossDupFlag.FIELD, true);
    initializeHeader(header);
    header.setUtcTimeStamp(OrigSendingTime.FIELD, header.getUtcTimeStamp(SendingTime.FIELD));
    header.setInt(MsgSeqNum.FIELD, beginSeqNo);
    sequenceReset.setInt(NewSeqNo.FIELD, newSeqNo);
    sequenceReset.setBoolean(GapFillFlag.FIELD, true);
    if (receivedMessage != null && enableLastMsgSeqNumProcessed) {
        try {
            sequenceReset.getHeader().setInt(LastMsgSeqNumProcessed.FIELD,
                    receivedMessage.getHeader().getInt(MsgSeqNum.FIELD));
        } catch (final FieldNotFound e) {
            //should not happen as MsgSeqNum must be present
            getLog().onErrorEvent("Received message without MsgSeqNum " + receivedMessage);
        }
    }
    sendViaFixFilter(sequenceReset, beginSeqNo);
    getLog().onEvent("Sent SequenceReset TO: " + newSeqNo);
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:32,代码来源:Session.java


示例5: generateLogout

import quickfix.field.MsgType; //导入依赖的package包/类
/**
 * To generate a logout message
 * @param otherLogout if not null, the logout message that is causing a logout to be sent
 * @param text
 */
private void generateLogout(Message otherLogout, String text) {
    final Message logout = messageFactory.create(sessionID.getBeginString(), MsgType.LOGOUT);
    initializeHeader(logout.getHeader());
    if (text != null && !"".equals(text)) {
        logout.setString(Text.FIELD, text);
    }
    if (otherLogout != null && enableLastMsgSeqNumProcessed) {
        try {
            logout.getHeader().setInt(LastMsgSeqNumProcessed.FIELD,
                    otherLogout.getHeader().getInt(MsgSeqNum.FIELD));
        } catch (final FieldNotFound e) {
            //should not happen as MsgSeqNum must be present
            getLog().onErrorEvent("Received logout without MsgSeqNum");
        }
    }
    sendViaFixFilter(logout, 0);
    state.setLogoutSent(true);
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:24,代码来源:Session.java


示例6: generateReject

import quickfix.field.MsgType; //导入依赖的package包/类
private void generateReject(Message message, String str) throws FieldNotFound, IOException {
    final String beginString = sessionID.getBeginString();
    final Message reject = messageFactory.create(beginString, MsgType.REJECT);
    final Header header = message.getHeader();

    reject.reverseRoute(header);
    initializeHeader(reject.getHeader());

    final String msgType = header.getString(MsgType.FIELD);
    final String msgSeqNum = header.getString(MsgSeqNum.FIELD);
    if (beginString.compareTo(FixVersions.BEGINSTRING_FIX42) >= 0) {
        reject.setString(RefMsgType.FIELD, msgType);
    }
    reject.setString(RefSeqNum.FIELD, msgSeqNum);

    if (!msgType.equals(MsgType.LOGON) && !msgType.equals(MsgType.SEQUENCE_RESET)
            && !isPossibleDuplicate(message)) {
        state.incrNextTargetMsgSeqNum();
    }

    reject.setString(Text.FIELD, str);
    sendViaFixFilter(reject, 0);
    getLog().onErrorEvent("Reject sent for Message " + msgSeqNum + ": " + str);

}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:26,代码来源:Session.java


示例7: setRejectReason

import quickfix.field.MsgType; //导入依赖的package包/类
private void setRejectReason(Message reject, int field, String reason,
        boolean includeFieldInReason) {
    boolean isRejectMessage;
    try {
        isRejectMessage = MsgType.REJECT.equals(reject.getHeader().getString(MsgType.FIELD));
    } catch (final FieldNotFound e) {
        isRejectMessage = false;
    }
    if (isRejectMessage
            && sessionID.getBeginString().compareTo(FixVersions.BEGINSTRING_FIX42) >= 0) {
        reject.setInt(RefTagID.FIELD, field);
        reject.setString(Text.FIELD, reason);
    } else {
        reject.setString(Text.FIELD, reason + (includeFieldInReason ? " (" + field + ")" : ""));
    }
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:17,代码来源:Session.java


示例8: generateBusinessReject

import quickfix.field.MsgType; //导入依赖的package包/类
private void generateBusinessReject(Message message, int err, int field) throws FieldNotFound,
        IOException {
    final Message reject = messageFactory.create(sessionID.getBeginString(),
            MsgType.BUSINESS_MESSAGE_REJECT);
    initializeHeader(reject.getHeader());
    final String msgType = message.getHeader().getString(MsgType.FIELD);
    final String msgSeqNum = message.getHeader().getString(MsgSeqNum.FIELD);
    reject.setString(RefMsgType.FIELD, msgType);
    reject.setString(RefSeqNum.FIELD, msgSeqNum);
    reject.setInt(BusinessRejectReason.FIELD, err);
    state.incrNextTargetMsgSeqNum();

    final String reason = BusinessRejectReasonText.getMessage(err);
    setRejectReason(reject, field, reason, field != 0);
    getLog().onErrorEvent(
            "Reject sent for Message " + msgSeqNum + (reason != null ? (": " + reason) : "")
                    + (field != 0 ? (": tag=" + field) : ""));

    sendViaFixFilter(reject, 0);
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:21,代码来源:Session.java


示例9: validLogonState

import quickfix.field.MsgType; //导入依赖的package包/类
private synchronized boolean validLogonState(String msgType) {
    if (msgType.equals(MsgType.LOGON) && state.isResetSent() || state.isResetReceived()) {
        return true;
    }
    if (msgType.equals(MsgType.LOGON) && !state.isLogonReceived()
            || !msgType.equals(MsgType.LOGON) && state.isLogonReceived()) {
        return true;
    }
    if (msgType.equals(MsgType.LOGOUT) && state.isLogonSent()) {
        return true;
    }
    if (!msgType.equals(MsgType.LOGOUT) && state.isLogoutSent()) {
        return true;
    }
    if (msgType.equals(MsgType.SEQUENCE_RESET)) {
        return true;
    }
    if (msgType.equals(MsgType.REJECT)) {
        return true;
    }
    return false;
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:23,代码来源:Session.java


示例10: nextQueued

import quickfix.field.MsgType; //导入依赖的package包/类
private boolean nextQueued(int num) throws FieldNotFound, RejectLogon, IncorrectDataFormat,
        IncorrectTagValue, UnsupportedMessageType, IOException, InvalidMessage {
    final Message msg = state.dequeue(num);

    if (msg != null) {
        getLog().onEvent("Processing queued message: " + num);

        final String msgType = msg.getHeader().getString(MsgType.FIELD);
        if (msgType.equals(MsgType.LOGON) || msgType.equals(MsgType.RESEND_REQUEST)) {
            state.incrNextTargetMsgSeqNum();
        } else {
            // TODO SESSION Is it really necessary to convert the queued message to a string?
            next(msg.toString());
        }
        return true;
    }
    return false;
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:19,代码来源:Session.java


示例11: next

import quickfix.field.MsgType; //导入依赖的package包/类
private void next(String msg) throws InvalidMessage, FieldNotFound, RejectLogon,
        IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType, IOException {
    try {
        next(parseMessage(msg));
    } catch (final InvalidMessage e) {
        final String message = "Invalid message: " + e;
        if (MsgType.LOGON.equals(MessageUtils.getMessageType(msg))) {
            disconnect(message, true);
        } else {
            getLog().onErrorEvent(message);
            if (resetOrDisconnectIfRequired(null)) {
                return;
            }
        }
        throw e;
    }
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:18,代码来源:Session.java


示例12: generateLogon

import quickfix.field.MsgType; //导入依赖的package包/类
private void generateLogon(Message otherLogon) throws FieldNotFound {
    final Message logon = messageFactory.create(sessionID.getBeginString(), MsgType.LOGON);
    logon.setInt(EncryptMethod.FIELD, EncryptMethod.NONE_OTHER);
    if (state.isResetReceived()) {
        logon.setBoolean(ResetSeqNumFlag.FIELD, true);
    }
    logon.setInt(HeartBtInt.FIELD, otherLogon.getInt(HeartBtInt.FIELD));
    if (sessionID.isFIXT()) {
        logon.setField(senderDefaultApplVerID);
    }
    if (enableLastMsgSeqNumProcessed) {
        logon.getHeader().setInt(LastMsgSeqNumProcessed.FIELD,
                otherLogon.getHeader().getInt(MsgSeqNum.FIELD));
    }
    initializeHeader(logon.getHeader());
    //field 789
    if (enableNextExpectedMsgSeqNum) {
        //the expected target num will be incremented one the other logon has been processed
        logon.setInt(NextExpectedMsgSeqNum.FIELD, getExpectedTargetNum() + 1);
    }
    sendViaFixFilter(logon, 0);
    state.setLogonSent(true);
}
 
开发者ID:fix-protocol-tools,项目名称:STAFF,代码行数:24,代码来源:Session.java


示例13: encode

import quickfix.field.MsgType; //导入依赖的package包/类
private static void encode(MessageBuilder mb, RawMessageAssembler asm, SessionID sessionID, OutputChannel out) throws IOException {
    mb.clear();
    mb.setMessageType(MsgType.ORDER_SINGLE);
    mb.add(FixTags.SenderLocationID, SENDER_LOCATION_ID);
    mb.add(FixTags.Account, ACCOUNT);
    mb.add(FixTags.ClOrdID, ORDER_ID);
    mb.add(FixTags.HandlInst, HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE);
    mb.add(FixTags.OrderQty, QUANTITY);
    mb.add(FixTags.OrdType, OrdType.LIMIT);
    mb.add(FixTags.Price, PRICE);
    mb.add(FixTags.Side, Side.BUY);
    mb.add(FixTags.Symbol, SYMBOL);
    mb.add(FixTags.Text, TEXT);
    mb.add(FixTags.TimeInForce, TimeInForce.DAY);
    mb.addUTCTimestamp(FixTags.TransactTime, System.currentTimeMillis());
    mb.add(FixTags.SecurityDesc, SECURITY_DESCRIPTION);
    mb.add(FixTags.SecurityType, SecurityType.OPTION);
    asm.send(sessionID, MSG_SEQ_NUM, mb, null, RealTimeSource.INSTANCE.currentTimeMillis(), out);
}
 
开发者ID:andymalakov,项目名称:f1x,代码行数:20,代码来源:Test_EncodingNewOrderSingle.java


示例14: onMessage

import quickfix.field.MsgType; //导入依赖的package包/类
private void onMessage(final Message message, final SessionID sessionID)
{
    messages.add(message);
    try
    {
        final String msgType = message.getHeader().getField(new MsgType()).getValue();
        if (MsgType.LOGOUT.equals(msgType))
        {
            logouts.add(sessionID);
        }
    }
    catch (FieldNotFound fieldNotFound)
    {
        LangUtil.rethrowUnchecked(fieldNotFound);
    }
}
 
开发者ID:real-logic,项目名称:fix-integration,代码行数:17,代码来源:FakeQuickFixApplication.java


示例15: onMessage

import quickfix.field.MsgType; //导入依赖的package包/类
@Override
public void onMessage(String direction, Message message, SessionID sessionId)
{
	try
	{
		MsgType msgType = (MsgType) message.getHeader().getField(
				new MsgType());
		MessagesTableModelData data = new MessagesTableModelData(
				new Date(), direction, QFixUtil.getSessionName(sessionId),
				message.toString(), msgType.getValue());
		addRow(data);
	} catch (FieldNotFound ex)
	{
		logger.error("An exception occured!", ex);
	}
}
 
开发者ID:jramoyo,项目名称:quickfix-messenger,代码行数:17,代码来源:MessagesTableModel.java


示例16: fromAdmin

import quickfix.field.MsgType; //导入依赖的package包/类
@Override
public void fromAdmin(Message message, SessionID sessionId)
		throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue,
		RejectLogon
{
	// Listen for Session Reject messages
	MsgType msgType = (MsgType) message.getHeader().getField(new MsgType());
	if (msgType.getValue().equals("3"))
	{
		for (QFixMessageListener messageListener : messageListeners)
		{
			messageListener.onMessage(QFixMessageListener.RECV, message,
					sessionId);
		}
	}
}
 
开发者ID:jramoyo,项目名称:quickfix-messenger,代码行数:17,代码来源:QFixMessengerApplication.java


示例17: getMsgTypeDescription

import quickfix.field.MsgType; //导入依赖的package包/类
public static String getMsgTypeDescription(String messageString)
        throws IllegalArgumentException, IllegalAccessException {
    MsgType msgType = new MsgType(getMsgType(messageString));

    java.lang.reflect.Field[] declaredFields = MsgType.class
            .getDeclaredFields();
    for (java.lang.reflect.Field field : declaredFields) {
        int modifiers = field.getModifiers();
        if (Modifier.isStatic(modifiers)
                && field.getType().equals(String.class)) {
            String value = (String) field.get(null);
            if (msgType.getValue().equals(value)) { return field.getName(); }
        }
    }

    return null;
}
 
开发者ID:RockManJoe64,项目名称:fixprotocol-test-suite,代码行数:18,代码来源:FIXProtocol.java


示例18: fromApp

import quickfix.field.MsgType; //导入依赖的package包/类
@Override
public void fromApp(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
    try {
        String msgType = message.getHeader().getString(35);
        switch (msgType) {
            case MsgType.QUOTE_REQUEST:
                String reqId = message.getString(QuoteReqID.FIELD);
                subscriptions.put(reqId, sessionID);

                LOGGER.debug("Subscribed with QuoteReqID={}", reqId);
                break;
            case MsgType.QUOTE_CANCEL:
                reqId = message.getString(QuoteReqID.FIELD);
                subscriptions.remove(reqId);
                LOGGER.debug("Unsubscribed with QuoteReqID={}", reqId);
                break;

        }
    } catch (FieldNotFound fieldNotFound) {
        fieldNotFound.printStackTrace();
    }
}
 
开发者ID:kpavlov,项目名称:fixio,代码行数:23,代码来源:QuickFixStreamingApp.java


示例19: doApplicationMessageEventsTest

import quickfix.field.MsgType; //导入依赖的package包/类
private void doApplicationMessageEventsTest(SessionID acceptorSessionID, SessionID initiatorSessionID, QuickfixjEngine quickfixjEngine) throws SessionNotFound,
    InterruptedException, FieldNotFound {

    final List<EventRecord> events = new ArrayList<EventRecord>();
    final CountDownLatch messageLatch = new CountDownLatch(1);

    QuickfixjEventListener messageListener = new QuickfixjEventListener() {
        @Override
        public synchronized void onEvent(QuickfixjEventCategory eventCategory, SessionID sessionID, Message message) {
            EventRecord event = new EventRecord(eventCategory, sessionID, message);
            events.add(event);
            if (eventCategory == QuickfixjEventCategory.AppMessageReceived) {
                messageLatch.countDown();
            }
        }
    };

    quickfixjEngine.addEventListener(messageListener);
    Email email = TestSupport.createEmailMessage("Test");
    Session.sendToTarget(email, initiatorSessionID);

    assertTrue("Application message not received", messageLatch.await(5000, TimeUnit.MILLISECONDS));
    quickfixjEngine.removeEventListener(messageListener);

    assertThat(events.size(), is(2));

    EventRecord sendEvent = new EventRecord(QuickfixjEventCategory.AppMessageSent, initiatorSessionID, new Message());
    assertTrue(events.contains(sendEvent));
    int sendEventIndex = events.indexOf(sendEvent);
    assertThat(events.get(sendEventIndex).message.getHeader().getString(MsgType.FIELD), is(MsgType.EMAIL));

    EventRecord receiveEvent = new EventRecord(QuickfixjEventCategory.AppMessageReceived, acceptorSessionID, new Message());
    assertTrue(events.contains(receiveEvent));
    int receiveEventIndex = events.indexOf(receiveEvent);
    assertThat(events.get(receiveEventIndex).message.getHeader().getString(MsgType.FIELD), is(MsgType.EMAIL));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:QuickfixjEngineTest.java


示例20: create

import quickfix.field.MsgType; //导入依赖的package包/类
@Override
public Message create(String beginString, String msgType) {
    if (beginString.equals(FixVersions.BEGINSTRING_FIX42) && msgType.equals(MsgType.ORDER_SINGLE)) {
        return new CustomNewOrderSingle();
    }
    return super.create(beginString, msgType);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:QuickfixjSpringTest.java



注:本文中的quickfix.field.MsgType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FrenchStemmer类代码示例发布时间:2022-05-22
下一篇:
Java FolderException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap