本文整理了Java中org.apache.rocketmq.common.message.Message.getUserProperty()
方法的一些代码示例,展示了Message.getUserProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getUserProperty()
方法的具体详情如下:
包路径:org.apache.rocketmq.common.message.Message
类名称:Message
方法名:getUserProperty
暂无
代码示例来源:origin: spring-cloud-incubator/spring-cloud-alibaba
@Override
public LocalTransactionState executeLocalTransactionBranch(Message msg, Object arg) {
if ("1".equals(msg.getUserProperty("test"))) {
System.out.println(new String(msg.getBody()) + " rollback");
return LocalTransactionState.ROLLBACK_MESSAGE;
}
System.out.println(new String(msg.getBody()) + " commit");
return LocalTransactionState.COMMIT_MESSAGE;
}
}
代码示例来源:origin: apache/rocketmq
/**
* @since version3.4.6
*/
@Test
public void testSendChinaUserProp() {
Message msg = MessageFactory.getRandomMessage(topic);
String msgKey = "jueyinKey";
String msgValue = "jueyinzhi";
msg.putUserProperty(msgKey, msgValue);
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
producer.send(msg, null);
assertThat(producer.getAllMsgBody().size()).isEqualTo(1);
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
Message sendMsg = (Message) producer.getFirstMsg();
Message recvMsg = (Message) consumer.getListener().getFirstMsg();
assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
}
代码示例来源:origin: apache/rocketmq
/**
* @since version3.4.6
*/
@Test
public void testSendEnglishUserProp() {
Message msg = MessageFactory.getRandomMessage(topic);
String msgKey = "jueyinKey";
String msgValue = "jueyinValue";
msg.putUserProperty(msgKey, msgValue);
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
producer.send(msg, null);
assertThat(producer.getAllMsgBody().size()).isEqualTo(1);
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
Message sendMsg = (Message) producer.getFirstMsg();
Message recvMsg = (Message) consumer.getListener().getFirstMsg();
assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
代码示例来源:origin: didi/DDMQ
/**
* @since version3.4.6
*/
@Test
public void testSendEnglishUserProp() {
Message msg = MessageFactory.getRandomMessage(topic);
String msgKey = "jueyinKey";
String msgValue = "jueyinValue";
msg.putUserProperty(msgKey, msgValue);
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
producer.send(msg, null);
assertThat(producer.getAllMsgBody().size()).isEqualTo(1);
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
Message sendMsg = (Message) producer.getFirstMsg();
Message recvMsg = (Message) consumer.getListener().getFirstMsg();
assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
代码示例来源:origin: didi/DDMQ
/**
* @since version3.4.6
*/
@Test
public void testSendChinaUserProp() {
Message msg = MessageFactory.getRandomMessage(topic);
String msgKey = "jueyinKey";
String msgValue = "jueyinzhi";
msg.putUserProperty(msgKey, msgValue);
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
producer.send(msg, null);
assertThat(producer.getAllMsgBody().size()).isEqualTo(1);
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
Message sendMsg = (Message) producer.getFirstMsg();
Message recvMsg = (Message) consumer.getListener().getFirstMsg();
assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
}
内容来源于网络,如有侵权,请联系作者删除!