本文整理汇总了Java中com.alibaba.rocketmq.common.message.Message.putUserProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Message.putUserProperty方法的具体用法?Java Message.putUserProperty怎么用?Java Message.putUserProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.rocketmq.common.message.Message
的用法示例。
在下文中一共展示了Message.putUserProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.alibaba.rocketmq.common.message.Message; //导入方法依赖的package包/类
public static void main(String[] args) throws MQClientException, InterruptedException {
DefaultMQProducer producer = new DefaultMQProducer("ProducerGroupName");
producer.start();
try {
for (int i = 0; i < 6000000; i++) {
Message msg = new Message("TopicFilter7",// topic
"TagA",// tag
"OrderID001",// key
("Hello MetaQ").getBytes());// body
msg.putUserProperty("SequenceId", String.valueOf(i));
SendResult sendResult = producer.send(msg);
System.out.println(sendResult);
}
}
catch (Exception e) {
e.printStackTrace();
}
producer.shutdown();
}
示例2: main
import com.alibaba.rocketmq.common.message.Message; //导入方法依赖的package包/类
public static void main(String[] args) throws MQClientException, InterruptedException {
DefaultMQProducer producer = new DefaultMQProducer("ProducerGroupName");
producer.setNamesrvAddr("10.235.170.7:9877");
producer.setNamesrvAddr("127.0.0.1:9876");
producer.start();
try {
for (int i = 0; i < 6000000; i++) {
Message msg = new Message("TopicFilter7",// topic
"TagA",// tag
"OrderID001",// key
("Hello MetaQ").getBytes());// body
msg.putUserProperty("SequenceId", String.valueOf(i));
SendResult sendResult = producer.send(msg);
System.out.println(sendResult);
}
}
catch (Exception e) {
e.printStackTrace();
}
producer.shutdown();
}