activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Tully" <gary.tu...@gmail.com>
Subject Re: Embedded broker, adding connections after broker was configured with xbean:
Date Wed, 20 Aug 2008 12:35:58 GMT
I think the issue is that the broker configured via
"xbean:activemq.xml" is started eagerly. That is, it is started before
your connector is added. What should help is to add a start="false"
attribute to the broker xbean.

not sure what is deemed the correct way, there are a bunch of ways to
configure and start a broker. A way that works for you is the correct
way!

hope this helps.

2008/8/20 Eugeny N Dzhurinsky <bofh@redwerk.com>:
> Hello all!
>
> I have the activemq.xml file, listed below:
>
> <beans>
>    <bean
>        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>    <broker brokerName="broker0" xmlns="http://activemq.org/config/1.0">
>        <managementContext>
>            <managementContext connectorPort="1599"
>                jmxDomainName="org.apache.activemq"/>
>        </managementContext>
>        <!--
>        <transportConnectors>
>            <transportConnector name="openwire" uri="tcp://localhost:1235" />
>        </transportConnectors>
>        -->
>    </broker>
>    <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
>        <connectors>
>            <nioConnector port="8161" />
>        </connectors>
>        <handlers>
>            <webAppContext contextPath="/fileserver"
>                resourceBase="webapps/" logUrlOnStart="true" />
>        </handlers>
>    </jetty>
> </beans>
>
> When transportConnectors section was uncommented, everything is working fine -
> the broker is listening for connections at port 1235.
>
> Due to flexibility requests we need to allow the application to be configured
> by passing the broker connection url through the command line, so we decided
> to comment out the transportConnectors section and use addConnection() method
> in the broker as listed below:
>
>    final BrokerService broker = BrokerFactory.createBroker(new URI(
>                        "xbean:activemq.xml"));
>    System.out.format("Using transport connector '%1$s'\n", connectorUrl);
>    broker.addConnector(connectorUrl);
>    broker.start();
>
> However this doesn't work well - while there is something listening on port
> 1235, the remote clients of the brokers are getting such exception during
> connection:
>
> Exception in thread "main" javax.jms.JMSException: Wire format negotiation timeout: peer
did not send his wire format.
>        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
>        at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1206)
>        at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1289)
>        at org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:456)
>
> With replacing the code line
>    final BrokerService broker = BrokerFactory.createBroker(new URI(
>                        "xbean:activemq.xml"));
> with
>
> final BrokerService broker = new BrokerService();
>
> everything works fine and connections are negitiated and accepted by broker.
>
> the question is - what is the correct way to add the connection listeners to the
> BrokerService, configured with bean definition like I pasted above?
>
> Thank you in advance!
>
> --
> Eugene N Dzhurinsky
>

Mime
View raw message