/** * Gets an iterator on the coordinator stream, starting from the starting offset the consumer was registered with. * * @return an iterator on the coordinator stream pointing to the starting offset the consumer was registered with. */ public SystemStreamPartitionIterator getStartIterator() { return new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); }
/** * Gets an iterator on the coordinator stream, starting from the starting offset the consumer was registered with. * * @return an iterator on the coordinator stream pointing to the starting offset the consumer was registered with. */ public SystemStreamPartitionIterator getStartIterator() { return new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); }
/** * Gets an iterator on the coordinator stream, starting from the starting offset the consumer was registered with. * * @return an iterator on the coordinator stream pointing to the starting offset the consumer was registered with. */ public SystemStreamPartitionIterator getStartIterator() { return new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); }
/** * Gets an iterator on the coordinator stream, starting from the starting offset the consumer was registered with. * * @return an iterator on the coordinator stream pointing to the starting offset the consumer was registered with. */ public SystemStreamPartitionIterator getStartIterator() { return new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); }
/** * Gets an iterator on the coordinator stream, starting from the starting offset the consumer was registered with. * * @return an iterator on the coordinator stream pointing to the starting offset the consumer was registered with. */ public SystemStreamPartitionIterator getStartIterator() { return new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); }
/** * Restore each store in taskStoresToRestore sequentially */ public void restoreStores() { LOG.debug("Restoring stores for task: {}", taskModel.getTaskName()); for (String storeName : taskStoresToRestore) { SystemConsumer systemConsumer = systemConsumers.get(storeName); SystemStream systemStream = changelogSystemStreams.get(storeName); SystemStreamPartitionIterator systemStreamPartitionIterator = new SystemStreamPartitionIterator(systemConsumer, new SystemStreamPartition(systemStream, taskModel.getChangelogPartition())); taskStores.get(storeName).restore(systemStreamPartitionIterator); } }
@Override public void init() { if (isInitialized.compareAndSet(false, true)) { LOG.info("Starting the coordinator stream system consumer with config: {}.", config); registerConsumer(); systemConsumer.start(); systemProducer.register(SOURCE); systemProducer.start(); iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); bootstrapMessagesFromStream(); } else { LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition); } }
@Override public void init() { if (isInitialized.compareAndSet(false, true)) { LOG.info("Starting the coordinator stream system consumer with config: {}.", config); registerConsumer(); systemConsumer.start(); systemProducer.register(SOURCE); systemProducer.start(); iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); bootstrapMessagesFromStream(); } else { LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition); } }
@Override public void init() { if (isInitialized.compareAndSet(false, true)) { LOG.info("Starting the coordinator stream system consumer with config: {}.", config); registerConsumer(); systemConsumer.start(); systemProducer.register(SOURCE); systemProducer.start(); iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); bootstrapMessagesFromStream(); } else { LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition); } }
@Override public void init() { if (isInitialized.compareAndSet(false, true)) { LOG.info("Starting the coordinator stream system consumer with config: {}.", config); registerConsumer(); systemConsumer.start(); systemProducer.register(SOURCE); systemProducer.start(); iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); bootstrapMessagesFromStream(); } else { LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition); } }
@Override public void init() { if (isInitialized.compareAndSet(false, true)) { LOG.info("Starting the coordinator stream system consumer with config: {}.", config); registerConsumer(); systemConsumer.start(); systemProducer.register(SOURCE); systemProducer.start(); iterator = new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition); bootstrapMessagesFromStream(); } else { LOG.info("Store had already been initialized. Skipping.", coordinatorSystemStreamPartition); } }
new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
new SystemStreamPartitionIterator(systemConsumer, coordinatorSystemStreamPartition);
@Test public void testNoMessages() { int numMessages = 0; MockSystemConsumer consumer = new MockSystemConsumer(numMessages); SystemStreamPartitionIterator iterator = new SystemStreamPartitionIterator(consumer, SSP); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected not to get any more messages from iterator."); } catch (NoSuchElementException e) { // expected } }
@Test public void testHasNextShouldWork() { int numMessages = 10; MockSystemConsumer consumer = new MockSystemConsumer(numMessages); SystemStreamPartitionIterator iterator = new SystemStreamPartitionIterator(consumer, SSP); while (iterator.hasNext()) { assertEquals(--numMessages, iterator.next().getMessage()); } assertFalse(iterator.hasNext()); assertEquals(0, numMessages); }
@Test public void testNextWithoutHasNextCallShouldWorkWhenAvailableAndFailWhenNot() { int numMessages = 10; MockSystemConsumer consumer = new MockSystemConsumer(numMessages); SystemStreamPartitionIterator iterator = new SystemStreamPartitionIterator(consumer, SSP); for (int i = 0; i < numMessages; ++i) { assertEquals(numMessages - i - 1, iterator.next().getMessage()); } assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected not to get any more messages from iterator."); } catch (NoSuchElementException e) { // expected } }