activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Snyder" <bruce.sny...@gmail.com>
Subject Re: Network of Brokers - Broker A talking to Broker B
Date Tue, 19 Feb 2008 21:18:56 GMT
On Feb 19, 2008 10:38 AM, wha <willy.ha@cgi.com> wrote:
>
> Well I don't know what to say, it doesn't work for me when I do
> advisorySupport="false"
>
> If you want to try it. Here's my BrokerA activemq.xml
>
>   <broker xmlns="http://activemq.org/config/1.0"
>         brokerName="brokerA"
>         dataDirectory="${activemq.base}/data"
>         useJmx="true"
>         advisorySupport="false">
>
>     <transportConnectors>
>        <transportConnector name="inFromProducer" uri="tcp://localhost:8881"
> />
>     </transportConnectors>
>
>     <networkConnectors>
>                 <networkConnector name="outToBrokerB"
> uri="static://(tcp://localhost:9991)" dynamicOnly="true" networkTTL="3">
>                 </networkConnector>
>         </networkConnectors>
>   </broker>
>
> Here's my BrokerB, activemq.xml
>
>   <broker xmlns="http://activemq.org/config/1.0"
>         brokerName="brokerB"
>         dataDirectory="${activemq.base}/data"
>         useJmx="true"
>         advisorySupport="true">
>
>     <transportConnectors>
>        <transportConnector name="inFromBrokerA" uri="tcp://localhost:9991"
> />
>     </transportConnectors>
>
>     <networkConnectors>
>     </networkConnectors>
>   </broker>
>
>
> Here's my consumer code:
>
>         public void run()
>         {
>                 //Create a connection
>                 Connection conn = null;
>                 String user = null;
>                 String passw = null;
>                 String brokerurl = "tcp://localhost:9991";
>                 try
>                 {
>                         ActiveMQConnectionFactory connFactory = new
> ActiveMQConnectionFactory(user,passw,brokerurl);
>                         conn = connFactory.createConnection();
>                         conn.start();
>
>                         session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
>                         conn.setExceptionListener(this);
>
>                         Queue dest = session.createQueue("TEST.Q1");
>
>                         MessageConsumer msgConsumer = session.createConsumer(dest);
>
>                         msgConsumer.setMessageListener(this);
>
>                         System.out.println("Listening Q1...");
>
>                 }
>                 catch (JMSException jmse)
>                 {
>                         System.out.println("JMSException in run() : " + jmse);
>                 }
>         }
>
>         public void onException(JMSException jmse)
>         {
>                 System.out.println(jmse);
>         }
>
>         public void onMessage(Message mess)
>         {
>                 try
>                 {
>                         //Thread.sleep(5 * 1000);
>
>                         DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
>                         java.util.Date date = new java.util.Date();
>
>                         System.out.println(dateFormat.format(date) + " - Received msg:
" +
> ((TextMessage)mess).getText());
>                         mess.acknowledge();
>
>                 }
>                 catch (JMSException jmse)
>                 {
>                         System.out.println("JMSException in onMessage()" + jmse);
>                 }
>         }
>
> And I didn't use any custom producer. I used the "Send To" from the Web
> Admin Queues page.
>
> When I turn the advisorySupport to "false" on BrokerB, Store and Forward
> stops working.
>
> Is this a bug ? Should I post a Jira ?

As Rob stated, a network of brokers requires that the advisory topics
be enabled, and it is enabled by default in the BrokerService object.
The only way to disable it is to do so explicitly via the
advisorySupport attribute on the broker element. In none of the
instructions I provided did I advise setting the advisorySupport
attribute to false.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Mime
View raw message