/** * Creates the coordinator stream, and starts the system producer. */ public void start() { if (isStarted) { log.info("Coordinator stream producer already started"); return; } log.info("Starting coordinator stream producer."); systemProducer.start(); systemAdmin.start(); isStarted = true; }
/** * Creates the coordinator stream, and starts the system producer. */ public void start() { if (isStarted) { log.info("Coordinator stream producer already started"); return; } log.info("Starting coordinator stream producer."); systemProducer.start(); systemAdmin.start(); isStarted = true; }
/** * Creates the coordinator stream, and starts the system producer. */ public void start() { if (isStarted) { log.info("Coordinator stream producer already started"); return; } log.info("Starting coordinator stream producer."); systemProducer.start(); systemAdmin.start(); isStarted = true; }
/** * Creates the coordinator stream, and starts the system producer. */ public void start() { if (isStarted) { log.info("Coordinator stream producer already started"); return; } log.info("Starting coordinator stream producer."); systemProducer.start(); systemAdmin.start(); isStarted = true; }
/** * Creates the coordinator stream, and starts the system producer. */ public void start() { if (isStarted) { log.info("Coordinator stream producer already started"); return; } log.info("Starting coordinator stream producer."); systemProducer.start(); systemAdmin.start(); isStarted = true; }
@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); } }
@Test public void testSystemFactoryCreateAndStartProducer() { Config eventHubConfig = createEventHubConfig(); EventHubSystemFactory systemFactory = new EventHubSystemFactory(); SystemProducer systemProducer = systemFactory.getProducer(SYSTEM_NAME, eventHubConfig, new NoOpMetricsRegistry()); Assert.assertNotNull(systemProducer); systemProducer.register(STREAM_NAME1); systemProducer.register(STREAM_NAME2); systemProducer.start(); systemProducer.stop(); }
systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start();
systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start();
@Test public void testSendToSpecificPartition() { Config eventHubConfig = MockEventHubConfigFactory.getEventHubConfig(EventHubSystemProducer.PartitioningMethod.PARTITION_KEY_AS_PARTITION); EventHubSystemFactory systemFactory = new EventHubSystemFactory(); SystemProducer systemProducer = systemFactory.getProducer(SYSTEM_NAME, eventHubConfig, new NoOpMetricsRegistry()); systemProducer.register(STREAM_NAME1); systemProducer.start(); for (int i = 0; i < 100; i++) { systemProducer.send(STREAM_NAME1, createMessageEnvelope(STREAM_NAME1, 0)); } systemProducer.flush(STREAM_NAME1); systemProducer.stop(); }
@Test public void testSend() { Config eventHubConfig = createEventHubConfig(); EventHubSystemFactory systemFactory = new EventHubSystemFactory(); SystemProducer systemProducer = systemFactory.getProducer(SYSTEM_NAME, eventHubConfig, new NoOpMetricsRegistry()); systemProducer.register(STREAM_NAME1); try { systemProducer.send(STREAM_NAME1, createMessageEnvelope(STREAM_NAME1)); Assert.fail("Sending event before starting producer should throw exception"); } catch (SamzaException e) { } systemProducer.start(); systemProducer.send(STREAM_NAME1, createMessageEnvelope(STREAM_NAME1)); try { systemProducer.send("unregistered_stream", createMessageEnvelope("unregistered_stream")); Assert.fail("Sending event to destination that is not registered should throw exception"); } catch (SamzaException e) { } try { systemProducer.register(STREAM_NAME2); Assert.fail("Trying to register after starting producer should throw exception"); } catch (SamzaException e) { } systemProducer.flush(STREAM_NAME1); systemProducer.stop(); }