activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ttmdev <>
Subject Re: Active MQ broker embedded with spring configuration problems
Date Mon, 04 Feb 2008 16:15:50 GMT

Here's a sample spring cfg file that I've used to start an 'embedded'
ActiveMQ broker. Note how the connectionFactory bean points the embedded
broker to an external ActiveMQ broker cfg file, which I have also included
below. Within the broker cfg file you can define your transport and network
connector elements. In this example, the broker's cfg file should be in the
classpath. I am using the latest 5.1 SNAPSHOT. Hope this helps - Joe

  xsi:schemaLocation="" > 
  <!-- An AMQ connection factory bean that starts an embedded broker and
points the 
        broker to a broker cfg file. -->
  <bean id="connectionFactory"
     <property name="brokerURL"
  <!-- Specify a destination -->
  <bean id="myDestination"
    <constructor-arg index="0" value="Q.TEST"/>        
  <!-- Wire this JMS template to the appropriate connection factory and
destination -->
  <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">    
    <property name="connectionFactory" ref="connectionFactory"/>    
    <property name="defaultDestination" ref="myDestination"/>
  <!-- This is the send bean, which we wire to the JMS template --> 
  <bean id="sendBean" class="spring.SendBean">
    <property name="jmsTemplate" ref="jmsTemplate"/>  
    <property name="destination" ref="myDestination"/>  


**** The broker's cfg file (activemq_clt.xml) ****


  <!-- Allows us to use system properties as variables in this configuration
file -->
  <broker xmlns="" brokerName="embeddedbroker"
       <transportConnector name="tcp" uri="tcp://localhost:61616"/>       

       <networkConnector name="pool" uri="static:(tcp://localhost:61617)" />
       <managementContext connectorPort="1100"

Michal Singer wrote:
> Hi. I am trying to raise an embedded Active MQ broker using spring
> configuration file. I work with spring 2.0.6 & Active MQ 5.0.0. The only
> way that works is this:
>  <amq:broker brokerName="brokerFactory" useJmx="true" persistent="true">
>    <amq:managementContext>
>         <amq:managementContext connectorPort="1099"
> jmxDomainName="org.apache.activemq"/>
>     </amq:managementContext>
>     <amq:transportConnectors>
>       <amq:transportConnector name="openwire" uri="tcp://localhost:61616"
> />
>     </amq:transportConnectors>
>   </amq:broker>
> With this way i have a few problems:
> 1. how do i define the active mq configuration file. i can't see any way?
> 2. I am trying to define: amq:networkConnectors but I get the following
> error - 
> org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was
> found starting with element 'amq:networkConnectors'. One of
> '{WC[##other:""]}' is expected.
> I use the following namespace and according to the documentation this
> element should work:
> Any help would be highly appreciated.
> Thanks

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message