/** * Stops the underlying SystemProducer. */ public void stop() { log.info("Stopping coordinator stream producer."); systemProducer.stop(); systemAdmin.stop(); isStarted = false; }
/** * Stops the underlying SystemProducer. */ public void stop() { log.info("Stopping coordinator stream producer."); systemProducer.stop(); systemAdmin.stop(); isStarted = false; }
/** * Stops the underlying SystemProducer. */ public void stop() { log.info("Stopping coordinator stream producer."); systemProducer.stop(); systemAdmin.stop(); isStarted = false; }
/** * Stops the underlying SystemProducer. */ public void stop() { log.info("Stopping coordinator stream producer."); systemProducer.stop(); systemAdmin.stop(); isStarted = false; }
/** * Stops the underlying SystemProducer. */ public void stop() { log.info("Stopping coordinator stream producer."); systemProducer.stop(); systemAdmin.stop(); isStarted = false; }
@Override public void stop() { log.info("Shutting down the StreamAppender..."); transferThread.interrupt(); try { transferThread.join(); } catch (InterruptedException e) { log.error("Interrupted while waiting for transfer thread to finish.", e); Thread.currentThread().interrupt(); } flushSystemProducer(); if (systemProducer != null) { systemProducer.stop(); } }
@Override public void close() { log.info("Shutting down the StreamAppender..."); if (!this.closed) { this.closed = true; transferThread.interrupt(); try { transferThread.join(); } catch (InterruptedException e) { log.error("Interrupted while waiting for transfer thread to finish.", e); Thread.currentThread().interrupt(); } flushSystemProducer(); if (systemProducer != null) { systemProducer.stop(); } } }
@Override public void close() { try { LOG.info("Stopping the coordinator stream system consumer.", config); systemAdmin.stop(); systemProducer.stop(); systemConsumer.stop(); } catch (Exception e) { LOG.error("Exception occurred when closing the metadata store:", e); } }
@Override public void close() { try { LOG.info("Stopping the coordinator stream system consumer.", config); systemAdmin.stop(); systemProducer.stop(); systemConsumer.stop(); } catch (Exception e) { LOG.error("Exception occurred when closing the metadata store:", e); } }
@Override public void close() { try { LOG.info("Stopping the coordinator stream system consumer.", config); systemAdmin.stop(); systemProducer.stop(); systemConsumer.stop(); } catch (Exception e) { LOG.error("Exception occurred when closing the metadata store:", e); } }
@Override public void close() { try { LOG.info("Stopping the coordinator stream system consumer.", config); systemAdmin.stop(); systemProducer.stop(); systemConsumer.stop(); } catch (Exception e) { LOG.error("Exception occurred when closing the metadata store:", e); } }
@Override public void close() { try { LOG.info("Stopping the coordinator stream system consumer.", config); systemAdmin.stop(); systemProducer.stop(); systemConsumer.stop(); } catch (Exception e) { LOG.error("Exception occurred when closing the metadata store:", e); } }
@Test public void testRegisterStop() throws Exception { producer.stop(); verify(processorOne).flush(); verify(processorTwo).flush(); verify(processorOne).close(); verify(processorTwo).close(); verify(CLIENT).close(); }
@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(); }
@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(); }