You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by davidnewcomb <da...@bigsoft.co.uk> on 2008/02/13 18:52:08 UTC

Embedding a broken in spring

Try as I might I just can not get the xml configuration to start an embedded
activemq broker.
Please can someone help turn my hack into a couple of short lines of xml.
I'm using ActiveMQ 5.0.0, Spring 2.5, JDK 1.6, Apache Tomcat/6.0.14

In the war\WEB-INF\sitemanager-servlet.xml

<bean id="broker" class="com.mycompany.sitemanager.QBroker"/>

The code for QBroker is:

package com.mycompany.sitemanager;

import java.net.URI;

import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class QBroker
  {
  protected final Log logger = LogFactory.getLog(getClass());
  private static String brokerUrl = "broker:tcp://localhost:61616" ;
  
  QBroker() throws Exception
    {
    logger.info ("Broker Setup") ;

    BrokerService broker = BrokerFactory.createBroker (new URI (brokerUrl))
;
    broker.start () ;

    logger.info ("Broker Setup End") ;
    }
  }

Thanks
-- 
View this message in context: http://www.nabble.com/Embedding-a-broken-in-spring-tp15461571s2354p15461571.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.