@PreDestroy public void stop() throws Exception { try { this.consumer.stop(); } catch (Exception ex) { log.error("Can't stop consumer template", ex); } try { this.producer.stop(); } catch (Exception ex) { log.error("Can't stop producer template", ex); } try { this.ctx.stop(); } catch (Exception ex) { log.error("Can't stop camel context template", ex); } }
private static void doStopTemplates(ConsumerTemplate consumer, ProducerTemplate template, FluentProducerTemplate fluentTemplate) throws Exception { if (consumer != null) { if (consumer == threadConsumer.get()) { threadConsumer.remove(); } consumer.stop(); } if (template != null) { if (template == threadTemplate.get()) { threadTemplate.remove(); } template.stop(); } if (fluentTemplate != null) { if (fluentTemplate == threadFluentTemplate.get()) { threadFluentTemplate.remove(); } fluentTemplate.stop(); } }
public void destroy() throws Exception { producerTemplate.stop(); }
public void stop() { try { producer.stop(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Stops the {@link ProducerTemplate}. */ @Override protected void doStop() { try { _producerTemplate.stop(); _logger.debug("Stopped producer template for " + _uri); } catch (Exception ex) { throw CommonCamelMessages.MESSAGES.failedToStopCamelProducerTemplateFor(_uri.toString(), ex); } }
/** * Stops the {@link ProducerTemplate}. */ @Override protected void doStop() { try { _producerTemplate.stop(); _logger.debug("Stopped producer template for " + _uri); } catch (Exception ex) { throw CommonCamelMessages.MESSAGES.failedToStopCamelProducerTemplateFor(_uri.toString(), ex); } }
ProducerTemplate tmp = ctx.createProducerTemplate(); tmp.setDefaultEndpoint(ctx.getEndpoint(uri+"&partitioner={{partitioner.class}}")); ctx.start(); tmp.sendBodyAndHeader("my test is working "+(new Random()).nextInt(100), KafkaConstants.PARTITION_KEY, 1); tmp.stop(); ctx.stop();
@Uninitialize public void uninitialize() { try { producerTemplate.stop(); } catch (final Exception e) { throw new SmooksException(e.getMessage(), e); } }
@Uninitialize public void uninitialize() { try { producerTemplate.stop(); } catch (final Exception e) { throw new SmooksException(e.getMessage(), e); } }
@PreDestroy public void stop() throws Exception { try { this.consumer.stop(); } catch (Exception ex) { log.error("Can't stop consumer template", ex); } try { this.producer.stop(); } catch (Exception ex) { log.error("Can't stop producer template", ex); } try { this.ctx.stop(); } catch (Exception ex) { log.error("Can't stop camel context template", ex); } }
if (msgProducer != null) { try { msgProducer.stop(); } catch (Exception ex) { LOG.error("error occurred during stopping producerTemplate", ex);
public static void main(String args[]) throws Exception { CamelContext context = new DefaultCamelContext(); // Set up the ActiveMQ JMS Components ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:51616"); // Note we can explicit name of the component context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); context.start(); ProducerTemplate template = context.createProducerTemplate(); String out = template.requestBodyAndHeader("jms:queue:loan", null, Constants.PROPERTY_SSN, "Client-A", String.class); System.out.println(out); template.stop(); context.stop(); }
public void run() throws Exception { context = createCamelContext(); context.addRoutes(createRouteBuilder()); template = context.createProducerTemplate(); context.start(); testManageTracer(); template.stop(); context.stop(); }
producerTemplate.stop();
producerTemplate.stop();
if (template != null) { try { template.stop(); } catch (Exception e) {