Java Code Examples for org.apache.rocketmq.store.MessageExtBrokerInner#setMsgId()

The following examples show how to use org.apache.rocketmq.store.MessageExtBrokerInner#setMsgId() . 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: MessageStoreWithFilterTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount,
                                             int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 2
Source File: MessageStoreWithFilterTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount,
                                             int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 3
Source File: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private MessageExtBrokerInner toMessageExtBrokerInner(MessageExt msgExt) {
    MessageExtBrokerInner inner = new MessageExtBrokerInner();
    inner.setTopic(TransactionalMessageUtil.buildHalfTopic());
    inner.setBody(msgExt.getBody());
    inner.setFlag(msgExt.getFlag());
    MessageAccessor.setProperties(inner, msgExt.getProperties());
    inner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
    inner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgExt.getTags()));
    inner.setQueueId(0);
    inner.setSysFlag(msgExt.getSysFlag());
    inner.setBornHost(msgExt.getBornHost());
    inner.setBornTimestamp(msgExt.getBornTimestamp());
    inner.setStoreHost(msgExt.getStoreHost());
    inner.setReconsumeTimes(msgExt.getReconsumeTimes());
    inner.setMsgId(msgExt.getMsgId());
    inner.setWaitStoreMsgOK(false);
    return inner;
}
 
Example 4
Source File: DefaultTransactionalMessageCheckListener.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private MessageExtBrokerInner toMessageExtBrokerInner(MessageExt msgExt) {
    TopicConfig topicConfig = this.getBrokerController().getTopicConfigManager().createTopicOfTranCheckMaxTime(TCMT_QUEUE_NUMS, PermName.PERM_READ | PermName.PERM_WRITE);
    int queueId = Math.abs(random.nextInt() % 99999999) % TCMT_QUEUE_NUMS;
    MessageExtBrokerInner inner = new MessageExtBrokerInner();
    inner.setTopic(topicConfig.getTopicName());
    inner.setBody(msgExt.getBody());
    inner.setFlag(msgExt.getFlag());
    MessageAccessor.setProperties(inner, msgExt.getProperties());
    inner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
    inner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgExt.getTags()));
    inner.setQueueId(queueId);
    inner.setSysFlag(msgExt.getSysFlag());
    inner.setBornHost(msgExt.getBornHost());
    inner.setBornTimestamp(msgExt.getBornTimestamp());
    inner.setStoreHost(msgExt.getStoreHost());
    inner.setReconsumeTimes(msgExt.getReconsumeTimes());
    inner.setMsgId(msgExt.getMsgId());
    inner.setWaitStoreMsgOK(false);
    return inner;
}
 
Example 5
Source File: TransactionalMessageBridge.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public MessageExtBrokerInner renewHalfMessageInner(MessageExt msgExt) {
    MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
    msgInner.setTopic(msgExt.getTopic());
    msgInner.setBody(msgExt.getBody());
    msgInner.setQueueId(msgExt.getQueueId());
    msgInner.setMsgId(msgExt.getMsgId());
    msgInner.setSysFlag(msgExt.getSysFlag());
    msgInner.setTags(msgExt.getTags());
    msgInner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgInner.getTags()));
    MessageAccessor.setProperties(msgInner, msgExt.getProperties());
    msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
    msgInner.setBornTimestamp(msgExt.getBornTimestamp());
    msgInner.setBornHost(msgExt.getBornHost());
    msgInner.setStoreHost(msgExt.getStoreHost());
    msgInner.setWaitStoreMsgOK(false);
    return msgInner;
}
 
Example 6
Source File: MessageStoreWithFilterTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount, int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 7
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount,
                                             int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 8
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount,
                                             int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 9
Source File: TransactionalMessageBridge.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
public MessageExtBrokerInner renewHalfMessageInner(MessageExt msgExt) {
    MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
    msgInner.setTopic(msgExt.getTopic());
    msgInner.setBody(msgExt.getBody());
    msgInner.setQueueId(msgExt.getQueueId());
    msgInner.setMsgId(msgExt.getMsgId());
    msgInner.setSysFlag(msgExt.getSysFlag());
    msgInner.setTags(msgExt.getTags());
    msgInner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgInner.getTags()));
    MessageAccessor.setProperties(msgInner, msgExt.getProperties());
    msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
    msgInner.setBornTimestamp(msgExt.getBornTimestamp());
    msgInner.setBornHost(msgExt.getBornHost());
    msgInner.setStoreHost(msgExt.getStoreHost());
    msgInner.setWaitStoreMsgOK(false);
    return msgInner;
}
 
Example 10
Source File: MessageStoreWithFilterTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount,
                                             int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));

            PutMessageResult result = master.putMessage(msg);

            msg.setMsgId(result.getAppendMessageResult().getMsgId());

            msgs.add(msg);
        }
    }

    return msgs;
}
 
Example 11
Source File: TransactionalMessageBridge.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public MessageExtBrokerInner renewHalfMessageInner(MessageExt msgExt) {
    MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
    msgInner.setTopic(msgExt.getTopic());
    msgInner.setBody(msgExt.getBody());
    msgInner.setQueueId(msgExt.getQueueId());
    msgInner.setMsgId(msgExt.getMsgId());
    msgInner.setSysFlag(msgExt.getSysFlag());
    msgInner.setTags(msgExt.getTags());
    msgInner.setTagsCode(MessageExtBrokerInner.tagsString2tagsCode(msgInner.getTags()));
    MessageAccessor.setProperties(msgInner, msgExt.getProperties());
    msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
    msgInner.setBornTimestamp(msgExt.getBornTimestamp());
    msgInner.setBornHost(msgExt.getBornHost());
    msgInner.setStoreHost(msgExt.getStoreHost());
    msgInner.setWaitStoreMsgOK(false);
    return msgInner;
}
 
Example 12
Source File: TransactionalMessageBridgeTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
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 13
Source File: DefaultTransactionalMessageCheckListenerTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
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 14
Source File: TransactionalMessageServiceImplTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
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 15
Source File: DefaultTransactionalMessageCheckListenerTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
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 16
Source File: TransactionalMessageBridgeTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
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 17
Source File: TransactionalMessageServiceImplTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
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 18
Source File: TransactionalMessageServiceImplTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
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 19
Source File: TransactionalMessageBridgeTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
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 20
Source File: DefaultTransactionalMessageCheckListenerTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
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;
}