Java Code Examples for org.apache.rocketmq.common.message.MessageBatch#generateFromList()
The following examples show how to use
org.apache.rocketmq.common.message.MessageBatch#generateFromList() .
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: DefaultMQProducer.java From rocketmq with Apache License 2.0 | 6 votes |
private MessageBatch batch(Collection<Message> msgs) throws MQClientException { MessageBatch msgBatch; try { msgBatch = MessageBatch.generateFromList(msgs); for (Message message : msgBatch) { Validators.checkMessage(message, this); MessageClientIDSetter.setUniqID(message); message.setTopic(withNamespace(message.getTopic())); } msgBatch.setBody(msgBatch.encode()); } catch (Exception e) { throw new MQClientException("Failed to initiate the MessageBatch", e); } msgBatch.setTopic(withNamespace(msgBatch.getTopic())); return msgBatch; }
Example 2
Source File: DefaultMQProducer.java From DDMQ with Apache License 2.0 | 5 votes |
private MessageBatch batch(Collection<Message> msgs) throws MQClientException { MessageBatch msgBatch; try { msgBatch = MessageBatch.generateFromList(msgs); for (Message message : msgBatch) { Validators.checkMessage(message, null); MessageClientIDSetter.setUniqID(message); } msgBatch.setBody(msgBatch.encode()); } catch (Exception e) { throw new MQClientException("Failed to initiate the MessageBatch", e); } return msgBatch; }
Example 3
Source File: DefaultMQProducer.java From DDMQ with Apache License 2.0 | 5 votes |
private MessageBatch batch(Collection<Message> msgs) throws MQClientException { MessageBatch msgBatch; try { msgBatch = MessageBatch.generateFromList(msgs); for (Message message : msgBatch) { Validators.checkMessage(message, null); MessageClientIDSetter.setUniqID(message); } msgBatch.setBody(msgBatch.encode()); } catch (Exception e) { throw new MQClientException("Failed to initiate the MessageBatch", e); } return msgBatch; }
Example 4
Source File: MessageBatchTest.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Delay() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setDelayTimeLevel(1); MessageBatch.generateFromList(messages); }
Example 5
Source File: MessageBatchTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffWaitOK() throws Exception{ List<Message> messages = generateMessages(); messages.get(1).setWaitStoreMsgOK(false); MessageBatch.generateFromList(messages); }
Example 6
Source File: MessageBatchTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Delay() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setDelayTimeLevel(1); MessageBatch.generateFromList(messages); }
Example 7
Source File: MessageBatchTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffWaitOK() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setWaitStoreMsgOK(false); MessageBatch.generateFromList(messages); }
Example 8
Source File: MessageBatchTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffTopic() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setTopic("topic2"); MessageBatch.generateFromList(messages); }
Example 9
Source File: MessageBatchTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Test public void testGenerate_OK() throws Exception { List<Message> messages = generateMessages(); MessageBatch.generateFromList(messages); }
Example 10
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffTopic() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setTopic("topic2"); MessageBatch.generateFromList(messages); }
Example 11
Source File: MessageBatchTest.java From rocketmq with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffWaitOK() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setWaitStoreMsgOK(false); MessageBatch.generateFromList(messages); }
Example 12
Source File: MessageBatchTest.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Retry() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setTopic(MixAll.RETRY_GROUP_TOPIC_PREFIX + "topic"); MessageBatch.generateFromList(messages); }
Example 13
Source File: MessageBatchTest.java From rocketmq with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Delay() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setDelayTimeLevel(1); MessageBatch.generateFromList(messages); }
Example 14
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test public void testGenerate_OK() throws Exception { List<Message> messages = generateMessages(); MessageBatch.generateFromList(messages); }
Example 15
Source File: MessageBatchTest.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Test public void testGenerate_OK() throws Exception { List<Message> messages = generateMessages(); MessageBatch.generateFromList(messages); }
Example 16
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffWaitOK() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setWaitStoreMsgOK(false); MessageBatch.generateFromList(messages); }
Example 17
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Delay() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setDelayTimeLevel(1); MessageBatch.generateFromList(messages); }
Example 18
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_DiffWaitOK() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setWaitStoreMsgOK(false); MessageBatch.generateFromList(messages); }
Example 19
Source File: MessageBatchTest.java From rocketmq with Apache License 2.0 | 4 votes |
@Test(expected = UnsupportedOperationException.class) public void testGenerate_Retry() throws Exception { List<Message> messages = generateMessages(); messages.get(1).setTopic(MixAll.RETRY_GROUP_TOPIC_PREFIX + "topic"); MessageBatch.generateFromList(messages); }
Example 20
Source File: MessageBatchTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Test public void testGenerate_OK() throws Exception { List<Message> messages = generateMessages(); MessageBatch.generateFromList(messages); }