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>

     <bean factory-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 | mpilone@npr.org | o: 202-513-2679  m: 703-969-7493