activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Pilone <MPil...@npr.org>
Subject Re: Dynamic TransportConnector Config with xbean
Date Wed, 12 Sep 2012 16:20:03 GMT
Nevermind. I found I was just able to do:


<amq:broker id="broker" useJmx="true" start="true">

   <amq:persistenceAdapter>

     <amq:kahaDB  directory="$data_path}"/>

   </amq:persistenceAdapter>



   <property name="brokerName" ref="brokerName" />



   <property name="transportConnectors">

     <bean factory-bean="networkInterfaceTransportConnectorFactory" factory-method="create"
/>

   </property>



    <property name="networkConnectors">

      <bean factory-bean="networkInterfaceNetworkConnectorFactory" factory-method="create"
/>

    </property>

…

</amq:broker>


I didn't realize that I could mix normal spring context property tags with the amq namespaced
broker definition.


-mike

[cid:1E7CF47D-2660-4B4E-87D3-918850FE9EA8] | Mike Pilone | Software Architect, Distribution
| mpilone@npr.org<mailto:mpilone@npr.org> | o: 202-513-2679  m: 703-969-7493

From: Mike Pilone <mpilone@npr.org<mailto:mpilone@npr.org>>
Reply-To: "users@activemq.apache.org<mailto:users@activemq.apache.org>" <users@activemq.apache.org<mailto:users@activemq.apache.org>>
Date: Wednesday, September 12, 2012 10:13 AM
To: users <users@activemq.apache.org<mailto:users@activemq.apache.org>>
Subject: Dynamic TransportConnector Config with xbean

I'm trying to use the ActiveMQ Xbean configuration in a Spring configuration file to configure
an embedded broker. Up to now I've been simply instantiation a BrokerService and setting transport
connectors and network connectors directly. I'd like to switch to using the "amq" namespace
support but I'm having trouble figuring out how to dynamically generate the transport connectors
on the broker.

My deployments environments vary and many contain multiple interfaces so I specify my broker
URLs as a comma delimited string in a configuration file, such as:

brokerUrls = tcp://192.168.1.1:8025,tcp://192.168.10.1:8025,stomp://192.168.1.1:8035

I have a bean factory that I created that can generate a java.util.ArrayList of TransportConnectors
to use; however I don't see any easy way to reference this list from the Xbean configuration.
I want to do something like:


<amq:transportConnectors>

     <beanfactory-bean="networkInterfaceTransportConnectorFactory"factory-method="create"/>

   </amq:transportConnectors>


But that doesn't seem to work and generates the error:


org.springframework.beans.ConversionNotSupportedException: Failed to convert property value
of type 'java.util.ArrayList'

to required type 'java.util.List' for property 'transportConnectors'; nested exception is
java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required
type [org.apache.activemq.broker.TransportConnector] for property 'transportConnectors[0]':
no matching editors or conversion strategy found


I'm sure I could make this work through some combination of Spring 3's environment/profile
support, but I'd like to just be able to set a list of preconfigured transport connectors
on the broker during construction. Any suggestions?


Thanks,

-mike

[cid:9B908586-F4CE-45B1-ACE5-C4E217447737] | Mike Pilone | Software Architect, Distribution
| mpilone@npr.org<mailto:mpilone@npr.org> | o: 202-513-2679  m: 703-969-7493

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message