// Start delivery for local subscribers in all regions
for (Map.Entry<String, HedwigClient> entry : regionClientsMap.entrySet()) {
HedwigClient client = entry.getValue();
for (int i = 0; i < batchSize; i++) {
client.getSubscriber().startDelivery(ByteString.copyFromUtf8("Topic" + i),
ByteString.copyFromUtf8("LocalSubscriber"), new TestMessageHandler(consumeQueue));
}
}
// start region again
startRegion(regionId);
// wait for retry
Thread.sleep(3 * TEST_RETRY_REMOTE_SUBSCRIBE_INTERVAL_VALUE);
String regionName = REGION_PREFIX + regionId;
HedwigClient client = regionClientsMap.get(regionName);
for (int i = 0; i < batchSize; i++) {
client.getSubscriber().asyncSubscribe(ByteString.copyFromUtf8("Topic" + i),
ByteString.copyFromUtf8("LocalSubscriber"), CreateOrAttach.CREATE_OR_ATTACH,
new TestCallback(queue), null);
assertTrue(queue.take());
client.getSubscriber().startDelivery(ByteString.copyFromUtf8("Topic" + i),
ByteString.copyFromUtf8("LocalSubscriber"), new TestMessageHandler(consumeQueue));
}
// Now start publishing messages for the subscribed topics in one of the
// regions and verify that it gets delivered and consumed in all of the
// other ones.