You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/03/27 14:45:05 UTC
[GitHub] zubchenok opened a new issue #1455: MessageID has always batch index 0 when sending messages in a batch
zubchenok opened a new issue #1455: MessageID has always batch index 0 when sending messages in a batch
URL: https://github.com/apache/incubator-pulsar/issues/1455
When I send messages I always get 0 in batchIndex component of MessageID. Here is a unit test that reproduce the issue:
` @Test
public void testSameBatchIndex() throws Exception
{
String topicName = "persistent://test-prop/vv/ns1/test-" + UUID.randomUUID();
PulsarClient pulsarClient = PulsarClient.create("pulsar://vv:6650");
Producer producer = pulsarClient.createProducer(topicName, new ProducerConfiguration()
.setBatchingEnabled(true)
.setBatchingMaxMessages(1000)
.setBatchingMaxPublishDelay(1, TimeUnit.SECONDS)
);
Consumer consumer = pulsarClient.subscribe(topicName, "subscription", new ConsumerConfiguration()
.setMessageListener((consumer1, message) -> System.out.println("Read: " + message.getMessageId()))
);
producer.sendAsync("A".getBytes()).whenCompleteAsync((messageId, throwable) -> {
System.out.println("A: " + messageId);
});
producer.sendAsync("B".getBytes()).whenCompleteAsync((messageId, throwable) -> {
System.out.println("B: " + messageId);
});
producer.sendAsync("C".getBytes()).whenCompleteAsync((messageId, throwable) -> {
System.out.println("C: " + messageId);
});
Thread.sleep(3333);
consumer.close();
producer.close();
pulsarClient.close();
}
`
Output is
`
A: 1286:0:-1:0
B: 1286:0:-1:0
C: 1286:0:-1:0
Read: 1286:0:-1:0
Read: 1286:0:-1:1
Read: 1286:0:-1:2
`
Expected output is
`
A: 1286:0:-1:0
B: 1286:0:-1:1
C: 1286:0:-1:2
Read: 1286:0:-1:0
Read: 1286:0:-1:1
Read: 1286:0:-1:2
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services