public boolean isAutoSendConsumeMessageEnabled() {
return false;
}
});
Subscriber mySubscriber = myClient.getSubscriber();
Publisher myPublisher = myClient.getPublisher();
ByteString myTopic = getTopic(0);
// Subscribe to a topic and start delivery on it
mySubscriber.asyncSubscribe(myTopic, localSubscriberId, CreateOrAttach.CREATE_OR_ATTACH,
new TestCallback(queue), null);
assertTrue(queue.take());
startDelivery(mySubscriber, myTopic, localSubscriberId, new TestMessageHandler(consumeQueue));
// Publish some messages
int batchSize = 10;
for (int i = 0; i < batchSize; i++) {
myPublisher.asyncPublish(myTopic, getMsg(i), new TestCallback(queue), null);
assertTrue(queue.take());
assertTrue(consumeQueue.take());
}
// Now manually send a consume message for each message received
for (int i = 0; i < batchSize; i++) {
boolean success = true;
try {
mySubscriber.consume(myTopic, localSubscriberId, MessageSeqId.newBuilder().setLocalComponent(i + 1)
.build());
} catch (ClientNotSubscribedException e) {
success = false;
}
assertTrue(success);