Results 1 to 5 of 5

Thread: How can I start rabbitMQ broker during application startup?

  1. #1

    Default How can I start rabbitMQ broker during application startup?

    Hi All,

    I am new to Spring AMQP, I am planning to replace ActiveMQ with AMQP. I was starting ActiveMQ using the following code:
    Code:
          
    public void run() {
            xBeanBrokerService = applicationContext.getBean(org.apache.activemq.xbean.XBeanBrokerService.class);
            try {
              xBeanBrokerService.start();
            } catch (Exception e) {
              logger.error("Error while init ... ", e);
            }
          }
    Is there any way to start rabbitMQ broker during application startup?

    Thanks,
    Manish

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    RabbitMQ does not have an 'embedded' mode like ActiveMQ - it is not written in Java, it is written in Erlang - it runs in a separate process.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3

    Default

    Thanks Gary for quick response.
    So if I want to use AMQP, I have to start rabbitMQ broker separately. Or is there any way to tie the start and stop of broker with the application.

    Thanks,
    Manish

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,148

    Default

    You could use
    Code:
    Runtime.getRuntime().exec(...)
    to start (rabbitmq-server) and stop (rabbitmqctl stop) the broker, but that would be very unusual.

    Most people just leave the broker running all the time.
    Last edited by Gary Russell; Jan 6th, 2013 at 02:30 PM.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5

    Default

    Thanks Gary!!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •