Search in sources :

Example 1 with ActiveMQService

use of io.fabric8.mq.ActiveMQService in project fabric8 by jboss-fuse.

the class ActiveMQConsumerFactory method updateInternal.

private void updateInternal(Map<String, ?> configuration) throws Exception {
    try {
        LOG.info("Starting consumer");
        consumerService = new ActiveMQService(connectionFactory);
        consumerService.setMaxAttempts(10);
        consumerService.start();
        String destination = (String) configuration.get("destination");
        if (destination == null) {
            destination = DEFAULT_DESTINATION;
        }
        consumer = new ConsumerThread(consumerService, destination);
        consumer.start();
        LOG.info("Consumer started");
    } catch (JMSException e) {
        throw new Exception("Cannot start consumer", e);
    }
}
Also used : ActiveMQService(io.fabric8.mq.ActiveMQService) ConsumerThread(io.fabric8.mq.ConsumerThread) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException)

Example 2 with ActiveMQService

use of io.fabric8.mq.ActiveMQService in project fabric8 by jboss-fuse.

the class ActiveMQProducerFactory method updateInternal.

private void updateInternal(Map<String, ?> configuration) throws Exception {
    try {
        LOG.info("Starting producer");
        producerService = new ActiveMQService(connectionFactory);
        producerService.setMaxAttempts(10);
        producerService.start();
        String destination = (String) configuration.get("destination");
        if (destination == null) {
            destination = DEFAULT_DESTINATION;
        }
        producer = new ProducerThread(producerService, destination);
        producer.setSleep(500);
        producer.start();
        LOG.info("Producer started");
    } catch (JMSException e) {
        throw new Exception("Cannot start producer", e);
    }
}
Also used : ActiveMQService(io.fabric8.mq.ActiveMQService) ProducerThread(io.fabric8.mq.ProducerThread) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException)

Aggregations

ActiveMQService (io.fabric8.mq.ActiveMQService)2 JMSException (javax.jms.JMSException)2 ConsumerThread (io.fabric8.mq.ConsumerThread)1 ProducerThread (io.fabric8.mq.ProducerThread)1