Java Code Examples for org.apache.rocketmq.store.MessageExtBrokerInner#setTransactionId()
The following examples show how to use
org.apache.rocketmq.store.MessageExtBrokerInner#setTransactionId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EndTransactionProcessor.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
private MessageExtBrokerInner endMessageTransaction(MessageExt msgExt) { MessageExtBrokerInner msgInner = new MessageExtBrokerInner(); msgInner.setTopic(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_TOPIC)); msgInner.setQueueId(Integer.parseInt(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_QUEUE_ID))); msgInner.setBody(msgExt.getBody()); msgInner.setFlag(msgExt.getFlag()); msgInner.setBornTimestamp(msgExt.getBornTimestamp()); msgInner.setBornHost(msgExt.getBornHost()); msgInner.setStoreHost(msgExt.getStoreHost()); msgInner.setReconsumeTimes(msgExt.getReconsumeTimes()); msgInner.setWaitStoreMsgOK(false); msgInner.setTransactionId(msgExt.getUserProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); msgInner.setSysFlag(msgExt.getSysFlag()); TopicFilterType topicFilterType = (msgInner.getSysFlag() & MessageSysFlag.MULTI_TAGS_FLAG) == MessageSysFlag.MULTI_TAGS_FLAG ? TopicFilterType.MULTI_TAG : TopicFilterType.SINGLE_TAG; long tagsCodeValue = MessageExtBrokerInner.tagsString2tagsCode(topicFilterType, msgInner.getTags()); msgInner.setTagsCode(tagsCodeValue); MessageAccessor.setProperties(msgInner, msgExt.getProperties()); msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties())); MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC); MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID); return msgInner; }
Example 2
Source File: EndTransactionProcessor.java From rocketmq with Apache License 2.0 | 6 votes |
private MessageExtBrokerInner endMessageTransaction(MessageExt msgExt) { MessageExtBrokerInner msgInner = new MessageExtBrokerInner(); msgInner.setTopic(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_TOPIC)); msgInner.setQueueId(Integer.parseInt(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_QUEUE_ID))); msgInner.setBody(msgExt.getBody()); msgInner.setFlag(msgExt.getFlag()); msgInner.setBornTimestamp(msgExt.getBornTimestamp()); msgInner.setBornHost(msgExt.getBornHost()); msgInner.setStoreHost(msgExt.getStoreHost()); msgInner.setReconsumeTimes(msgExt.getReconsumeTimes()); msgInner.setWaitStoreMsgOK(false); msgInner.setTransactionId(msgExt.getUserProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); msgInner.setSysFlag(msgExt.getSysFlag()); TopicFilterType topicFilterType = (msgInner.getSysFlag() & MessageSysFlag.MULTI_TAGS_FLAG) == MessageSysFlag.MULTI_TAGS_FLAG ? TopicFilterType.MULTI_TAG : TopicFilterType.SINGLE_TAG; long tagsCodeValue = MessageExtBrokerInner.tagsString2tagsCode(topicFilterType, msgInner.getTags()); msgInner.setTagsCode(tagsCodeValue); MessageAccessor.setProperties(msgInner, msgExt.getProperties()); msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties())); MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC); MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID); return msgInner; }
Example 3
Source File: TransactionalMessageServiceImplTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner(long queueOffset, String topic, String body) { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setBornTimestamp(System.currentTimeMillis() - 80000); inner.setTransactionId("123456123"); inner.setTopic(topic); inner.setQueueOffset(queueOffset); inner.setBody(body.getBytes()); inner.setMsgId("123456123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 4
Source File: TransactionalMessageBridgeTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setTransactionId("12342123444"); inner.setBornTimestamp(System.currentTimeMillis()); inner.setBody("prepare".getBytes()); inner.setMsgId("123456-123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 5
Source File: DefaultTransactionalMessageCheckListenerTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageExt() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_REAL_QUEUE_ID,"1"); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX,"1234255"); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_REAL_TOPIC,"realTopic"); inner.setTransactionId(inner.getProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); inner.setBody("check".getBytes()); inner.setMsgId("12344567890"); inner.setQueueId(0); return inner; }
Example 6
Source File: EndTransactionProcessor.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 生成EmdMessageBrokerInner * @param msgExt ; * @return ; */ private MessageExtBrokerInner endMessageTransaction(MessageExt msgExt) { MessageExtBrokerInner msgInner = new MessageExtBrokerInner(); //设置其原来真实的topic msgInner.setTopic(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_TOPIC)); //设置其原来真实的队列id msgInner.setQueueId(Integer.parseInt(msgExt.getUserProperty(MessageConst.PROPERTY_REAL_QUEUE_ID))); //body msgInner.setBody(msgExt.getBody()); //flag msgInner.setFlag(msgExt.getFlag()); msgInner.setBornTimestamp(msgExt.getBornTimestamp()); msgInner.setBornHost(msgExt.getBornHost()); msgInner.setStoreHost(msgExt.getStoreHost()); msgInner.setReconsumeTimes(msgExt.getReconsumeTimes()); msgInner.setWaitStoreMsgOK(false); msgInner.setTransactionId(msgExt.getUserProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); msgInner.setSysFlag(msgExt.getSysFlag()); TopicFilterType topicFilterType = (msgInner.getSysFlag() & MessageSysFlag.MULTI_TAGS_FLAG) == MessageSysFlag.MULTI_TAGS_FLAG ? TopicFilterType.MULTI_TAG : TopicFilterType.SINGLE_TAG; long tagsCodeValue = MessageExtBrokerInner.tagsString2tagsCode(topicFilterType, msgInner.getTags()); msgInner.setTagsCode(tagsCodeValue); MessageAccessor.setProperties(msgInner, msgExt.getProperties()); msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties())); //清除两个属性 MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC); MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID); return msgInner; }
Example 7
Source File: TransactionalMessageServiceImplTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner(long queueOffset, String topic, String body) { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setBornTimestamp(System.currentTimeMillis() - 80000); inner.setTransactionId("123456123"); inner.setTopic(topic); inner.setQueueOffset(queueOffset); inner.setBody(body.getBytes()); inner.setMsgId("123456123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 8
Source File: TransactionalMessageBridgeTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setTransactionId("12342123444"); inner.setBornTimestamp(System.currentTimeMillis()); inner.setBody("prepare".getBytes()); inner.setMsgId("123456-123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 9
Source File: DefaultTransactionalMessageCheckListenerTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageExt() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_REAL_QUEUE_ID,"1"); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX,"1234255"); MessageAccessor.putProperty(inner,MessageConst.PROPERTY_REAL_TOPIC,"realTopic"); inner.setTransactionId(inner.getProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); inner.setBody("check".getBytes()); inner.setMsgId("12344567890"); inner.setQueueId(0); return inner; }
Example 10
Source File: TransactionalMessageServiceImplTest.java From rocketmq with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner(long queueOffset, String topic, String body) { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setBornTimestamp(System.currentTimeMillis() - 80000); inner.setTransactionId("123456123"); inner.setTopic(topic); inner.setQueueOffset(queueOffset); inner.setBody(body.getBytes()); inner.setMsgId("123456123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 11
Source File: TransactionalMessageBridgeTest.java From rocketmq with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageBrokerInner() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); inner.setTransactionId("12342123444"); inner.setBornTimestamp(System.currentTimeMillis()); inner.setBody("prepare".getBytes()); inner.setMsgId("123456-123"); inner.setQueueId(0); inner.setTopic("hello"); return inner; }
Example 12
Source File: DefaultTransactionalMessageCheckListenerTest.java From rocketmq with Apache License 2.0 | 5 votes |
private MessageExtBrokerInner createMessageExt() { MessageExtBrokerInner inner = new MessageExtBrokerInner(); MessageAccessor.putProperty(inner, MessageConst.PROPERTY_REAL_QUEUE_ID, "1"); MessageAccessor.putProperty(inner, MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX, "1234255"); MessageAccessor.putProperty(inner, MessageConst.PROPERTY_REAL_TOPIC, "realTopic"); inner.setTransactionId(inner.getProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX)); inner.setBody("check".getBytes()); inner.setMsgId("12344567890"); inner.setQueueId(0); return inner; }