You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Eric Bouer <er...@gmail.com> on 2009/06/05 11:27:25 UTC

Understanding MulticastDiscoveryAgentNotifier behavior.

Hello list.
I'm trying the following code to test multicast capabilities of
camel+activeMQ.
I found out that a new thread is started for each new message I send, but
the thread is staying alive for the whole program lifetime.
The number of live "multicast discovery agent notifier" threads scales up
linearly.
Is it a bug or something wrong with the code ?
Thanks.
Eric.
=============
package com.mycompany.CamelExample;
import javax.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.Logger;
public final class App {
   private static Logger log = Logger.getLogger("CamelTestApp");
   public static void main(String args[]) throws Exception {
        CamelContext context = new DefaultCamelContext();
        ConnectionFactory connectionFactory = 
                    new
ActiveMQConnectionFactory("failover:(discovery:(multicast://224.1.2.3:6255?group=default),tcp://localhost:61616)");
        final String JMSTOPID = "test-jms";
        final String DEST_TOPIC = "test-jms:topic:TCommandRequest";
        final String SRC_TOPIC = "test-jms:topic:TCommandRequest";
        context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
        context.addRoutes(new RouteBuilder() {
            public void configure() {from(SRC_TOPIC).to("mock:test");}});
        ProducerTemplate template = context.createProducerTemplate();
        context.start();
           while (true) {
                template.sendBody(DEST_TOPIC, "TEST_TEXT");
               Thread.sleep(5000);
            }
    }
}
======================
My log shows:

12:02:06,212  INFO DefaultCamelContext:729 - Apache Camel 2.0-M1
(CamelContext:camel-1) is starting
12:02:06,582  WARN ObjectHelper:523 - Cannot find class:
org.apache.xalan.xsltc.trax.DOM2SAX
12:02:07,137  INFO DiscoveryTransport:73 - Adding new broker connection URL:
tcp://192.168.0.1:61616
12:02:07,220  INFO FailoverTransport:714 - Successfully connected to
tcp://192.168.0.1:61616
12:02:07,222  INFO FailoverTransport:714 - Successfully connected to
discovery:(multicast://224.1.2.3:6255?group=default)
12:02:07,247  INFO DefaultCamelContext:771 - Apache Camel 2.0-M1
(CamelContext:camel-1) started
12:02:07,640  INFO DiscoveryTransport:73 - Adding new broker connection URL:
tcp://192.168.0.1:61616
12:02:07,715  INFO FailoverTransport:714 - Successfully connected to
tcp://192.168.0.1:61616
12:02:07,716  INFO FailoverTransport:714 - Successfully connected to
discovery:(multicast://224.1.2.3:6255?group=default)
12:02:13,181  INFO DiscoveryTransport:73 - Adding new broker connection URL:
tcp://192.168.64.1:61616
12:02:13,220  INFO FailoverTransport:714 - Successfully connected to
tcp://192.168.0.1:61616
12:02:13,222  INFO FailoverTransport:714 - Successfully connected to
discovery:(multicast://224.1.2.3:6255?group=default)
12:02:18,731  INFO DiscoveryTransport:73 - Adding new broker connection URL:
tcp://192.168.0.1:61616
12:02:18,961  INFO FailoverTransport:714 - Successfully connected to
tcp://192.168.0.1:61616
12:02:18,963  INFO FailoverTransport:714 - Successfully connected to
discovery:(multicast://224.1.2.3:6255?group=default)
.
.
.
.
http://www.nabble.com/file/p23885103/multicastdiscoveryagentnotifier.png 
-- 
View this message in context: http://www.nabble.com/Understanding-MulticastDiscoveryAgentNotifier-behavior.-tp23885103p23885103.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Understanding MulticastDiscoveryAgentNotifier behavior.

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Does the thread exit when you just set the ActiveMQConnectionFactory
with this URI tcp://localhost:61616.

If so, I doubt it could be ActiveMQ issue.

Willem

Eric Bouer wrote:
> Hello list.
> I'm trying the following code to test multicast capabilities of
> camel+activeMQ.
> I found out that a new thread is started for each new message I send, but
> the thread is staying alive for the whole program lifetime.
> The number of live "multicast discovery agent notifier" threads scales up
> linearly.
> Is it a bug or something wrong with the code ?
> Thanks.
> Eric.
> =============
> package com.mycompany.CamelExample;
> import javax.jms.ConnectionFactory;
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.camel.CamelContext;
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.jms.JmsComponent;
> import org.apache.camel.impl.DefaultCamelContext;
> import org.apache.log4j.Logger;
> public final class App {
>    private static Logger log = Logger.getLogger("CamelTestApp");
>    public static void main(String args[]) throws Exception {
>         CamelContext context = new DefaultCamelContext();
>         ConnectionFactory connectionFactory = 
>                     new
> ActiveMQConnectionFactory("failover:(discovery:(multicast://224.1.2.3:6255?group=default),tcp://localhost:61616)");
>         final String JMSTOPID = "test-jms";
>         final String DEST_TOPIC = "test-jms:topic:TCommandRequest";
>         final String SRC_TOPIC = "test-jms:topic:TCommandRequest";
>         context.addComponent("test-jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>         context.addRoutes(new RouteBuilder() {
>             public void configure() {from(SRC_TOPIC).to("mock:test");}});
>         ProducerTemplate template = context.createProducerTemplate();
>         context.start();
>            while (true) {
>                 template.sendBody(DEST_TOPIC, "TEST_TEXT");
>                Thread.sleep(5000);
>             }
>     }
> }
> ======================
> My log shows:
> 
> 12:02:06,212  INFO DefaultCamelContext:729 - Apache Camel 2.0-M1
> (CamelContext:camel-1) is starting
> 12:02:06,582  WARN ObjectHelper:523 - Cannot find class:
> org.apache.xalan.xsltc.trax.DOM2SAX
> 12:02:07,137  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:07,220  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:07,222  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:07,247  INFO DefaultCamelContext:771 - Apache Camel 2.0-M1
> (CamelContext:camel-1) started
> 12:02:07,640  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:07,715  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:07,716  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:13,181  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.64.1:61616
> 12:02:13,220  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:13,222  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:18,731  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:18,961  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:18,963  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> .
> .
> .
> .
> http://www.nabble.com/file/p23885103/multicastdiscoveryagentnotifier.png 


Re: Understanding MulticastDiscoveryAgentNotifier behavior.

Posted by Eric Bouer <er...@gmail.com>.
OK
If everything is fine in my code that I'm sure it's an issue and not a
programming error or somthing in camel-activemq.
I'll post in ActiveMQ users.
Thanks.



Claus Ibsen-2 wrote:
> 
> Hi
> 
> You should also ask at the AMQ forums as its really AMQ specific.
> 
> 
> On Fri, Jun 5, 2009 at 11:27 AM, Eric Bouer<er...@gmail.com> wrote:
>>
>> Hello list.
>> I'm trying the following code to test multicast capabilities of
>> camel+activeMQ.
>> I found out that a new thread is started for each new message I send, but
>> the thread is staying alive for the whole program lifetime.
>> The number of live "multicast discovery agent notifier" threads scales up
>> linearly.
>> Is it a bug or something wrong with the code ?
>> Thanks.
>> Eric.
>> =============
>> package com.mycompany.CamelExample;
>> import javax.jms.ConnectionFactory;
>> import org.apache.activemq.ActiveMQConnectionFactory;
>> import org.apache.camel.CamelContext;
>> import org.apache.camel.ProducerTemplate;
>> import org.apache.camel.builder.RouteBuilder;
>> import org.apache.camel.component.jms.JmsComponent;
>> import org.apache.camel.impl.DefaultCamelContext;
>> import org.apache.log4j.Logger;
>> public final class App {
>>   private static Logger log = Logger.getLogger("CamelTestApp");
>>   public static void main(String args[]) throws Exception {
>>        CamelContext context = new DefaultCamelContext();
>>        ConnectionFactory connectionFactory =
>>                    new
>> ActiveMQConnectionFactory("failover:(discovery:(multicast://224.1.2.3:6255?group=default),tcp://localhost:61616)");
>>        final String JMSTOPID = "test-jms";
>>        final String DEST_TOPIC = "test-jms:topic:TCommandRequest";
>>        final String SRC_TOPIC = "test-jms:topic:TCommandRequest";
>>        context.addComponent("test-jms",
>> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>>        context.addRoutes(new RouteBuilder() {
>>            public void configure() {from(SRC_TOPIC).to("mock:test");}});
>>        ProducerTemplate template = context.createProducerTemplate();
>>        context.start();
>>           while (true) {
>>                template.sendBody(DEST_TOPIC, "TEST_TEXT");
>>               Thread.sleep(5000);
>>            }
>>    }
>> }
>> ======================
>> My log shows:
>>
>> 12:02:06,212  INFO DefaultCamelContext:729 - Apache Camel 2.0-M1
>> (CamelContext:camel-1) is starting
>> 12:02:06,582  WARN ObjectHelper:523 - Cannot find class:
>> org.apache.xalan.xsltc.trax.DOM2SAX
>> 12:02:07,137  INFO DiscoveryTransport:73 - Adding new broker connection
>> URL:
>> tcp://192.168.0.1:61616
>> 12:02:07,220  INFO FailoverTransport:714 - Successfully connected to
>> tcp://192.168.0.1:61616
>> 12:02:07,222  INFO FailoverTransport:714 - Successfully connected to
>> discovery:(multicast://224.1.2.3:6255?group=default)
>> 12:02:07,247  INFO DefaultCamelContext:771 - Apache Camel 2.0-M1
>> (CamelContext:camel-1) started
>> 12:02:07,640  INFO DiscoveryTransport:73 - Adding new broker connection
>> URL:
>> tcp://192.168.0.1:61616
>> 12:02:07,715  INFO FailoverTransport:714 - Successfully connected to
>> tcp://192.168.0.1:61616
>> 12:02:07,716  INFO FailoverTransport:714 - Successfully connected to
>> discovery:(multicast://224.1.2.3:6255?group=default)
>> 12:02:13,181  INFO DiscoveryTransport:73 - Adding new broker connection
>> URL:
>> tcp://192.168.64.1:61616
>> 12:02:13,220  INFO FailoverTransport:714 - Successfully connected to
>> tcp://192.168.0.1:61616
>> 12:02:13,222  INFO FailoverTransport:714 - Successfully connected to
>> discovery:(multicast://224.1.2.3:6255?group=default)
>> 12:02:18,731  INFO DiscoveryTransport:73 - Adding new broker connection
>> URL:
>> tcp://192.168.0.1:61616
>> 12:02:18,961  INFO FailoverTransport:714 - Successfully connected to
>> tcp://192.168.0.1:61616
>> 12:02:18,963  INFO FailoverTransport:714 - Successfully connected to
>> discovery:(multicast://224.1.2.3:6255?group=default)
>> .
>> .
>> .
>> .
>> http://www.nabble.com/file/p23885103/multicastdiscoveryagentnotifier.png
>> --
>> View this message in context:
>> http://www.nabble.com/Understanding-MulticastDiscoveryAgentNotifier-behavior.-tp23885103p23885103.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Understanding-MulticastDiscoveryAgentNotifier-behavior.-tp23885103p23886006.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Understanding MulticastDiscoveryAgentNotifier behavior.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You should also ask at the AMQ forums as its really AMQ specific.


On Fri, Jun 5, 2009 at 11:27 AM, Eric Bouer<er...@gmail.com> wrote:
>
> Hello list.
> I'm trying the following code to test multicast capabilities of
> camel+activeMQ.
> I found out that a new thread is started for each new message I send, but
> the thread is staying alive for the whole program lifetime.
> The number of live "multicast discovery agent notifier" threads scales up
> linearly.
> Is it a bug or something wrong with the code ?
> Thanks.
> Eric.
> =============
> package com.mycompany.CamelExample;
> import javax.jms.ConnectionFactory;
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.camel.CamelContext;
> import org.apache.camel.ProducerTemplate;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.jms.JmsComponent;
> import org.apache.camel.impl.DefaultCamelContext;
> import org.apache.log4j.Logger;
> public final class App {
>   private static Logger log = Logger.getLogger("CamelTestApp");
>   public static void main(String args[]) throws Exception {
>        CamelContext context = new DefaultCamelContext();
>        ConnectionFactory connectionFactory =
>                    new
> ActiveMQConnectionFactory("failover:(discovery:(multicast://224.1.2.3:6255?group=default),tcp://localhost:61616)");
>        final String JMSTOPID = "test-jms";
>        final String DEST_TOPIC = "test-jms:topic:TCommandRequest";
>        final String SRC_TOPIC = "test-jms:topic:TCommandRequest";
>        context.addComponent("test-jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>        context.addRoutes(new RouteBuilder() {
>            public void configure() {from(SRC_TOPIC).to("mock:test");}});
>        ProducerTemplate template = context.createProducerTemplate();
>        context.start();
>           while (true) {
>                template.sendBody(DEST_TOPIC, "TEST_TEXT");
>               Thread.sleep(5000);
>            }
>    }
> }
> ======================
> My log shows:
>
> 12:02:06,212  INFO DefaultCamelContext:729 - Apache Camel 2.0-M1
> (CamelContext:camel-1) is starting
> 12:02:06,582  WARN ObjectHelper:523 - Cannot find class:
> org.apache.xalan.xsltc.trax.DOM2SAX
> 12:02:07,137  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:07,220  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:07,222  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:07,247  INFO DefaultCamelContext:771 - Apache Camel 2.0-M1
> (CamelContext:camel-1) started
> 12:02:07,640  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:07,715  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:07,716  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:13,181  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.64.1:61616
> 12:02:13,220  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:13,222  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> 12:02:18,731  INFO DiscoveryTransport:73 - Adding new broker connection URL:
> tcp://192.168.0.1:61616
> 12:02:18,961  INFO FailoverTransport:714 - Successfully connected to
> tcp://192.168.0.1:61616
> 12:02:18,963  INFO FailoverTransport:714 - Successfully connected to
> discovery:(multicast://224.1.2.3:6255?group=default)
> .
> .
> .
> .
> http://www.nabble.com/file/p23885103/multicastdiscoveryagentnotifier.png
> --
> View this message in context: http://www.nabble.com/Understanding-MulticastDiscoveryAgentNotifier-behavior.-tp23885103p23885103.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus