Hi Mike,

it's a nice approach. We should have something like this supported
especially for defining network connectors which can be complex to set.

Regards
-- 
Dejan Bosanac
Senior Software Engineer | FuseSource Corp.
dej...@fusesource.com | fusesource.com
skype: dejan.bosanac | twitter: @dejanb
blog: http://www.nighttale.net
ActiveMQ in Action: http://www.manning.com/snyder/



On Wed, Sep 12, 2012 at 6:20 PM, Mike Pilone <mpil...@npr.org> wrote:

> 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
>
>
>  | Mike Pilone | Software Architect, Distribution | mpil...@npr.org | o:
> 202-513-2679  m: 703-969-7493****
>
>
> From: Mike Pilone <mpil...@npr.org>
> Reply-To: "users@activemq.apache.org" <users@activemq.apache.org>
> Date: Wednesday, September 12, 2012 10:13 AM
> To: users <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
>
>
>  | Mike Pilone | Software Architect, Distribution | mpil...@npr.org | o:
> 202-513-2679  m: 703-969-7493****
>
>

Reply via email to