
Originally Posted by
jstrachan
There are a few options here despite the AMQ-77 issue. There is the URL you connect to the local embedded broker and the URL others use to connect to the embedded broker. So you can use vm://localhost to connect to the embedded broker - and other remote clients can connect using whatever transportConnector you've configured in your activemq.xml file.
e.g. a remove client could connect via tcp://somehost

ort yet the ConnectionFactory using the embedded broker should always use a vm://localhost style URL to avoid unnecessary networking/marshalling.
i.e. the URL you connect to in the ConnectionFactory is specified by the brokerURL property. The URLs that a broker accepts from remote VMs are specified in the transportConnector elements in the activemq.xml file. So 1 broker could accept 10 different URLs with different protocols and details (http, multicast, tcp, ssl and whatever ports you wish). It will always allow VM transport for JMS clients inside the same VM to connect efficiently.
I try this but I still hit the AMQ-77 problem:
Code:
2004-09-16 15:04:10,703 WARN
[org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy] - <Factory method public static org.codehaus.activemq.transport.TransportServerChannel org.codehaus.activemq.transport.TransportServerChannelProvider.newInstance(org.codehaus.activemq.message.WireFormat,java.lang.String) throws javax.jms.JMSException,java.net.URISyntaxException threw exception>
javax.jms.JMSException: Bind to tcp://localhost:61616 failed: Address already in use: JVM_Bind
Here's my configuration:
First, I declare a jmsFactory bean that will give me a ConnectionFactory whose url is vm://localhost, but it is configured to use a tcp connector:
Code:
<bean id="jmsFactory" class="org.codehaus.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>vm://localhost</value>
</property>
<property name="useEmbeddedBroker">
<value>true</value>
</property>
<property name="brokerContainerFactory">
<!-- specify that the ActiveMQ XML config file should be used to configure the Broker -->
<bean class="org.codehaus.activemq.spring.SpringBrokerContainerFactory">
<property name="resource">
<!-- <value>classpath:org/codehaus/activemq/spring/activemq.xml</value> -->
<value>/WEB-INF/springBroker.xml</value>
</property>
</bean>
</property>
</bean>
... with springBroker.xml contains:
Code:
<broker>
<connector>
<tcpServerTransport uri="tcp://localhost:61616" backlog="1000" useAsyncSend="true" maxOutstandingMessages="50"/>
</connector>
<persistence>
<jdbmPersistence directory="target/jdbm"/>
</persistence>
</broker>
Am I interpreting your instruction correctly? or am I missing something?