Java Code Examples for org.apache.rocketmq.common.message.Message#setBuyerId()
The following examples show how to use
org.apache.rocketmq.common.message.Message#setBuyerId() .
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: BatchSendIT.java From DDMQ with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }
Example 2
Source File: BatchSendIT.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }
Example 3
Source File: BatchSendIT.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }
Example 4
Source File: BatchSendIT.java From DDMQ with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }
Example 5
Source File: BatchSendIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }
Example 6
Source File: BatchSendIT.java From rocketmq with Apache License 2.0 | 4 votes |
@Test public void testBatchSend_CheckProperties() throws Exception { List<Message> messageList = new ArrayList<>(); Message message = new Message(); message.setTopic(topic); message.setKeys("keys123"); message.setTags("tags123"); message.setWaitStoreMsgOK(false); message.setBuyerId("buyerid123"); message.setFlag(123); message.setBody("body".getBytes()); messageList.add(message); DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr); SendResult sendResult = producer.send(messageList); Assert.assertEquals(SendStatus.SEND_OK, sendResult.getSendStatus()); String[] offsetIds = sendResult.getOffsetMsgId().split(","); String[] msgIds = sendResult.getMsgId().split(","); Assert.assertEquals(messageList.size(), offsetIds.length); Assert.assertEquals(messageList.size(), msgIds.length); Thread.sleep(2000); Message messageByOffset = producer.viewMessage(offsetIds[0]); Message messageByMsgId = producer.viewMessage(topic, msgIds[0]); System.out.println(messageByOffset); System.out.println(messageByMsgId); Assert.assertEquals(message.getTopic(), messageByMsgId.getTopic()); Assert.assertEquals(message.getTopic(), messageByOffset.getTopic()); Assert.assertEquals(message.getKeys(), messageByOffset.getKeys()); Assert.assertEquals(message.getKeys(), messageByMsgId.getKeys()); Assert.assertEquals(message.getTags(), messageByOffset.getTags()); Assert.assertEquals(message.getTags(), messageByMsgId.getTags()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByOffset.isWaitStoreMsgOK()); Assert.assertEquals(message.isWaitStoreMsgOK(), messageByMsgId.isWaitStoreMsgOK()); Assert.assertEquals(message.getBuyerId(), messageByOffset.getBuyerId()); Assert.assertEquals(message.getBuyerId(), messageByMsgId.getBuyerId()); Assert.assertEquals(message.getFlag(), messageByOffset.getFlag()); Assert.assertEquals(message.getFlag(), messageByMsgId.getFlag()); }