Announcement Announcement Module
Collapse
No announcement yet.
How can I start rabbitMQ broker during application startup? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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

      Comment


      • #4
        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, 03:30 PM.

        Comment


        • #5
          Thanks Gary!!

          Comment

          Working...
          X