You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by James Green <ja...@gmail.com> on 2011/07/11 10:42:47 UTC

Simple example

Hi,

Is it expected that a Netbeans Java (Maven) app can copy/paste the simple
example source code and run when configured to connect against an existing
ActiveMQ instance?

I must be doing something blindingly stupid, as it fails without any
exception for me!

I am connecting against my development ActiveMQ instance and telnetting to
it's port responds just fine. My output is below. Nothing appears in the
ActiveMQ web console for test.queue (queues are normally dynamically
created). What on earth am I not doing right?

SLF4J: The requested version 1.6 by your slf4j binding is not compatible
with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further
details.
234 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.7.2 (CamelContext: camel-1) is starting
234 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
Using ManagedManagementStrategy.
874 [main] INFO
org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 7
packages with 17 @Converter classes to load
906 [main] WARN org.apache.camel.impl.converter.DefaultTypeConverter -
Overriding type converter from: StaticMethodTypeConverter: public static
org.apache.activemq.command.ActiveMQDestination
org.apache.camel.component.activemq.ActiveMQConverter.toDestination(java.lang.String)
to: StaticMethodTypeConverter: public static
org.apache.activemq.command.ActiveMQDestination
org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
906 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
Loaded 152 type converters in 0.516 seconds
log4j:WARN No appenders could be found for logger
(org.springframework.jms.listener.DefaultMessageListenerContainer).
log4j:WARN Please initialize the log4j system properly.
1296 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1
started and consuming from: Endpoint[test-jms://queue:test.queue]
1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route2
started and consuming from: Endpoint[file://test]
1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes,
of which 2 is started.
1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.7.2 (CamelContext: camel-1) started in 1.078 seconds
Sent 0 to test.queue
Sent 1 to test.queue
Sent 2 to test.queue
Sent 3 to test.queue
Sent 4 to test.queue
Sent 5 to test.queue
Sent 6 to test.queue
Sent 7 to test.queue
Sent 8 to test.queue
Sent 9 to test.queue
2327 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.7.2 (CamelContext:camel-1) is shutting down
2327 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Starting to
graceful shutdown 2 routes (timeout 300 seconds)
2327 [Camel (camel-1) thread #1 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 suspended and
shutdown deferred, was consuming from: Endpoint[file://test]
6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
complete, was consuming from: Endpoint[test-jms://queue:test.queue]
6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 preparing to
shutdown complete.
6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 shutdown
complete.
6310 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Graceful
shutdown of 2 routes completed in 3 seconds
6310 [main] INFO org.apache.camel.impl.DefaultInflightRepository - Shutting
down with no inflight exchanges.
6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime: 6.076
seconds
6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.7.2 (CamelContext: camel-1) is shutdown in 3.983 seconds

Thanks in advance,

James

Re: Simple example

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jul 11, 2011 at 12:02 PM, James Green <ja...@gmail.com> wrote:
> Incidentally the example in camel.xml:
>
>        <route>
>            <from uri="activemq:example.A"/>
>            <to uri="activemq:example.B"/>
>        </route>
>
> Does appear to work although I had to manually create the example.B queue
> first.
>
> The factory here must be wrong - there's nothing showing in Wireshark at
> all. Just can't see what!
>

In your Camel route it logs when it shutdown, that it uses the scheme
name (test-jms).
Make sure you have configured this as the AcitveMQ component name.

See this page:
http://camel.apache.org/activemq

eg define a bean with the id=test-jms and let it be an AMQ component,
and have the the borkerURL set to the remote AMQ broker.

You would need to declare a <bean> for activemq, and configure the url
of the remote AMQ broker.



> On 11 July 2011 10:42, James Green <ja...@gmail.com> wrote:
>
>> I changed the factory line to the following:
>>
>>         ConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory(
>>                 "tcp://10.0.0.81:61616?broker.persistent=false");
>>
>> In activemq.xml:
>>
>> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>>
>> Our subnet is 10.0.0.0/24. I am .84, the test box is .81.
>>
>> When I telnet to it from my Netbeans I get a load of garbage with
>> "Activemq" in the middle so I'm pretty sure it's responding. If I run
>> Wireshark then invoke the java app nothing occurs on the wire though.
>>
>> I have switched on trace, and I have switched log4j to DEBUG for camel. I
>> can see the following in the log:
>>
>> 2011-07-11 10:39:06,561 | DEBUG | Route: route1 >>>
>> EventDrivenConsumerRoute[Endpoint[activemq://example.A] ->
>> Instrumentation:route[UnitOfWork(Channel[sendTo(Endpoint[activemq://example.B])])]]
>> | org.apache.camel.spring.SpringCamelContext | main
>> 2011-07-11 10:39:06,561 | DEBUG | Starting consumer (order: 1000) on route:
>> route1 | org.apache.camel.spring.SpringCamelContext | main
>> 2011-07-11 10:39:06,565 | DEBUG | Registered MBean with objectname:
>> org.apache.camel:context=ubuntu/camel-2,type=consumers,name=JmsConsumer(0x723704)
>> | org.apache.camel.management.DefaultManagementAgent | main
>> 2011-07-11 10:39:06,565 | DEBUG | Starting consumer:
>> Consumer[activemq://example.A] | org.apache.camel.component.jms.JmsConsumer
>> | main
>> 2011-07-11 10:39:06,567 | DEBUG | Established shared JMS Connection |
>> org.apache.camel.component.jms.JmsMessageListenerContainer | main
>> 2011-07-11 10:39:06,568 | DEBUG | Resumed paused task:
>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker@13e846f| org.apache.camel.component.jms.JmsMessageListenerContainer | main
>> 2011-07-11 10:39:06,580 | INFO  | Route: route1 started and consuming from:
>> Endpoint[activemq://example.A] | org.apache.camel.spring.SpringCamelContext
>> | main
>> 2011-07-11 10:39:06,580 | DEBUG | Creating endpoint
>> uri=[spring-event://default], path=[default], parameters=[{}] |
>> org.apache.camel.impl.DefaultComponent | main
>> 2011-07-11 10:39:06,580 | DEBUG | spring-event://default converted to
>> endpoint: Endpoint[spring-event://default] by component:
>> org.apache.camel.component.event.EventComponent@1cd04f1 |
>> org.apache.camel.spring.SpringCamelContext | main
>> 2011-07-11 10:39:06,581 | DEBUG | Registered MBean with objectname:
>> org.apache.camel:context=ubuntu/camel-2,type=endpoints,name="spring-event://default"
>> | org.apache.camel.management.DefaultManagementAgent | main
>> 2011-07-11 10:39:06,581 | INFO  | Total 1 routes, of which 1 is started. |
>> org.apache.camel.spring.SpringCamelContext | main
>> 2011-07-11 10:39:06,582 | INFO  | Apache Camel 2.7.0 (CamelContext: camel)
>> started in 0.175 seconds | org.apache.camel.spring.SpringCamelContext | main
>>
>> After which I run my app and nothing further is logged.
>>
>> James
>>
>>
>> On 11 July 2011 09:48, Charles Moulliard <cm...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Can you show us the configuration that you use to connect to activemq
>>> broker ? Maybe you connect to a local in memory instance using VM
>>> Transport protocol created when Camel starts and removed during the
>>> shutdown process. This is perhaps why you don't see anything in your
>>> ActiveMQ broker's queue.
>>>
>>> Use also Trace option of Camel = "true" to display more info in the log
>>> file
>>>
>>> <camelContext trace="true" ...
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>>
>>>
>>> On Mon, Jul 11, 2011 at 10:42 AM, James Green <ja...@gmail.com>
>>> wrote:
>>> > Hi,
>>> >
>>> > Is it expected that a Netbeans Java (Maven) app can copy/paste the
>>> simple
>>> > example source code and run when configured to connect against an
>>> existing
>>> > ActiveMQ instance?
>>> >
>>> > I must be doing something blindingly stupid, as it fails without any
>>> > exception for me!
>>> >
>>> > I am connecting against my development ActiveMQ instance and telnetting
>>> to
>>> > it's port responds just fine. My output is below. Nothing appears in the
>>> > ActiveMQ web console for test.queue (queues are normally dynamically
>>> > created). What on earth am I not doing right?
>>> >
>>> > SLF4J: The requested version 1.6 by your slf4j binding is not compatible
>>> > with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
>>> > SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further
>>> > details.
>>> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
>>> > 2.7.2 (CamelContext: camel-1) is starting
>>> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
>>> > Using ManagedManagementStrategy.
>>> > 874 [main] INFO
>>> > org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 7
>>> > packages with 17 @Converter classes to load
>>> > 906 [main] WARN org.apache.camel.impl.converter.DefaultTypeConverter -
>>> > Overriding type converter from: StaticMethodTypeConverter: public static
>>> > org.apache.activemq.command.ActiveMQDestination
>>> >
>>> org.apache.camel.component.activemq.ActiveMQConverter.toDestination(java.lang.String)
>>> > to: StaticMethodTypeConverter: public static
>>> > org.apache.activemq.command.ActiveMQDestination
>>> >
>>> org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
>>> > 906 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
>>> > Loaded 152 type converters in 0.516 seconds
>>> > log4j:WARN No appenders could be found for logger
>>> > (org.springframework.jms.listener.DefaultMessageListenerContainer).
>>> > log4j:WARN Please initialize the log4j system properly.
>>> > 1296 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
>>> route1
>>> > started and consuming from: Endpoint[test-jms://queue:test.queue]
>>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
>>> route2
>>> > started and consuming from: Endpoint[file://test]
>>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2
>>> routes,
>>> > of which 2 is started.
>>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>>> Camel
>>> > 2.7.2 (CamelContext: camel-1) started in 1.078 seconds
>>> > Sent 0 to test.queue
>>> > Sent 1 to test.queue
>>> > Sent 2 to test.queue
>>> > Sent 3 to test.queue
>>> > Sent 4 to test.queue
>>> > Sent 5 to test.queue
>>> > Sent 6 to test.queue
>>> > Sent 7 to test.queue
>>> > Sent 8 to test.queue
>>> > Sent 9 to test.queue
>>> > 2327 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>>> Camel
>>> > 2.7.2 (CamelContext:camel-1) is shutting down
>>> > 2327 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy -
>>> Starting to
>>> > graceful shutdown 2 routes (timeout 300 seconds)
>>> > 2327 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 suspended
>>> and
>>> > shutdown deferred, was consuming from: Endpoint[file://test]
>>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
>>> > complete, was consuming from: Endpoint[test-jms://queue:test.queue]
>>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 preparing
>>> to
>>> > shutdown complete.
>>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 shutdown
>>> > complete.
>>> > 6310 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy -
>>> Graceful
>>> > shutdown of 2 routes completed in 3 seconds
>>> > 6310 [main] INFO org.apache.camel.impl.DefaultInflightRepository -
>>> Shutting
>>> > down with no inflight exchanges.
>>> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime:
>>> 6.076
>>> > seconds
>>> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>>> Camel
>>> > 2.7.2 (CamelContext: camel-1) is shutdown in 3.983 seconds
>>> >
>>> > Thanks in advance,
>>> >
>>> > James
>>> >
>>>
>>
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Simple example

Posted by James Green <ja...@gmail.com>.
Incidentally the example in camel.xml:

        <route>
            <from uri="activemq:example.A"/>
            <to uri="activemq:example.B"/>
        </route>

Does appear to work although I had to manually create the example.B queue
first.

The factory here must be wrong - there's nothing showing in Wireshark at
all. Just can't see what!

On 11 July 2011 10:42, James Green <ja...@gmail.com> wrote:

> I changed the factory line to the following:
>
>         ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(
>                 "tcp://10.0.0.81:61616?broker.persistent=false");
>
> In activemq.xml:
>
> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
>
> Our subnet is 10.0.0.0/24. I am .84, the test box is .81.
>
> When I telnet to it from my Netbeans I get a load of garbage with
> "Activemq" in the middle so I'm pretty sure it's responding. If I run
> Wireshark then invoke the java app nothing occurs on the wire though.
>
> I have switched on trace, and I have switched log4j to DEBUG for camel. I
> can see the following in the log:
>
> 2011-07-11 10:39:06,561 | DEBUG | Route: route1 >>>
> EventDrivenConsumerRoute[Endpoint[activemq://example.A] ->
> Instrumentation:route[UnitOfWork(Channel[sendTo(Endpoint[activemq://example.B])])]]
> | org.apache.camel.spring.SpringCamelContext | main
> 2011-07-11 10:39:06,561 | DEBUG | Starting consumer (order: 1000) on route:
> route1 | org.apache.camel.spring.SpringCamelContext | main
> 2011-07-11 10:39:06,565 | DEBUG | Registered MBean with objectname:
> org.apache.camel:context=ubuntu/camel-2,type=consumers,name=JmsConsumer(0x723704)
> | org.apache.camel.management.DefaultManagementAgent | main
> 2011-07-11 10:39:06,565 | DEBUG | Starting consumer:
> Consumer[activemq://example.A] | org.apache.camel.component.jms.JmsConsumer
> | main
> 2011-07-11 10:39:06,567 | DEBUG | Established shared JMS Connection |
> org.apache.camel.component.jms.JmsMessageListenerContainer | main
> 2011-07-11 10:39:06,568 | DEBUG | Resumed paused task:
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker@13e846f| org.apache.camel.component.jms.JmsMessageListenerContainer | main
> 2011-07-11 10:39:06,580 | INFO  | Route: route1 started and consuming from:
> Endpoint[activemq://example.A] | org.apache.camel.spring.SpringCamelContext
> | main
> 2011-07-11 10:39:06,580 | DEBUG | Creating endpoint
> uri=[spring-event://default], path=[default], parameters=[{}] |
> org.apache.camel.impl.DefaultComponent | main
> 2011-07-11 10:39:06,580 | DEBUG | spring-event://default converted to
> endpoint: Endpoint[spring-event://default] by component:
> org.apache.camel.component.event.EventComponent@1cd04f1 |
> org.apache.camel.spring.SpringCamelContext | main
> 2011-07-11 10:39:06,581 | DEBUG | Registered MBean with objectname:
> org.apache.camel:context=ubuntu/camel-2,type=endpoints,name="spring-event://default"
> | org.apache.camel.management.DefaultManagementAgent | main
> 2011-07-11 10:39:06,581 | INFO  | Total 1 routes, of which 1 is started. |
> org.apache.camel.spring.SpringCamelContext | main
> 2011-07-11 10:39:06,582 | INFO  | Apache Camel 2.7.0 (CamelContext: camel)
> started in 0.175 seconds | org.apache.camel.spring.SpringCamelContext | main
>
> After which I run my app and nothing further is logged.
>
> James
>
>
> On 11 July 2011 09:48, Charles Moulliard <cm...@gmail.com> wrote:
>
>> Hi,
>>
>> Can you show us the configuration that you use to connect to activemq
>> broker ? Maybe you connect to a local in memory instance using VM
>> Transport protocol created when Camel starts and removed during the
>> shutdown process. This is perhaps why you don't see anything in your
>> ActiveMQ broker's queue.
>>
>> Use also Trace option of Camel = "true" to display more info in the log
>> file
>>
>> <camelContext trace="true" ...
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Apache Committer
>>
>> Blog : http://cmoulliard.blogspot.com
>> Twitter : http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>> Skype: cmoulliard
>>
>>
>>
>> On Mon, Jul 11, 2011 at 10:42 AM, James Green <ja...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > Is it expected that a Netbeans Java (Maven) app can copy/paste the
>> simple
>> > example source code and run when configured to connect against an
>> existing
>> > ActiveMQ instance?
>> >
>> > I must be doing something blindingly stupid, as it fails without any
>> > exception for me!
>> >
>> > I am connecting against my development ActiveMQ instance and telnetting
>> to
>> > it's port responds just fine. My output is below. Nothing appears in the
>> > ActiveMQ web console for test.queue (queues are normally dynamically
>> > created). What on earth am I not doing right?
>> >
>> > SLF4J: The requested version 1.6 by your slf4j binding is not compatible
>> > with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
>> > SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further
>> > details.
>> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
>> > 2.7.2 (CamelContext: camel-1) is starting
>> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
>> > Using ManagedManagementStrategy.
>> > 874 [main] INFO
>> > org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 7
>> > packages with 17 @Converter classes to load
>> > 906 [main] WARN org.apache.camel.impl.converter.DefaultTypeConverter -
>> > Overriding type converter from: StaticMethodTypeConverter: public static
>> > org.apache.activemq.command.ActiveMQDestination
>> >
>> org.apache.camel.component.activemq.ActiveMQConverter.toDestination(java.lang.String)
>> > to: StaticMethodTypeConverter: public static
>> > org.apache.activemq.command.ActiveMQDestination
>> >
>> org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
>> > 906 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
>> > Loaded 152 type converters in 0.516 seconds
>> > log4j:WARN No appenders could be found for logger
>> > (org.springframework.jms.listener.DefaultMessageListenerContainer).
>> > log4j:WARN Please initialize the log4j system properly.
>> > 1296 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
>> route1
>> > started and consuming from: Endpoint[test-jms://queue:test.queue]
>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
>> route2
>> > started and consuming from: Endpoint[file://test]
>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2
>> routes,
>> > of which 2 is started.
>> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>> Camel
>> > 2.7.2 (CamelContext: camel-1) started in 1.078 seconds
>> > Sent 0 to test.queue
>> > Sent 1 to test.queue
>> > Sent 2 to test.queue
>> > Sent 3 to test.queue
>> > Sent 4 to test.queue
>> > Sent 5 to test.queue
>> > Sent 6 to test.queue
>> > Sent 7 to test.queue
>> > Sent 8 to test.queue
>> > Sent 9 to test.queue
>> > 2327 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>> Camel
>> > 2.7.2 (CamelContext:camel-1) is shutting down
>> > 2327 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy -
>> Starting to
>> > graceful shutdown 2 routes (timeout 300 seconds)
>> > 2327 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 suspended
>> and
>> > shutdown deferred, was consuming from: Endpoint[file://test]
>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
>> > complete, was consuming from: Endpoint[test-jms://queue:test.queue]
>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 preparing
>> to
>> > shutdown complete.
>> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
>> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 shutdown
>> > complete.
>> > 6310 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy -
>> Graceful
>> > shutdown of 2 routes completed in 3 seconds
>> > 6310 [main] INFO org.apache.camel.impl.DefaultInflightRepository -
>> Shutting
>> > down with no inflight exchanges.
>> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime:
>> 6.076
>> > seconds
>> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache
>> Camel
>> > 2.7.2 (CamelContext: camel-1) is shutdown in 3.983 seconds
>> >
>> > Thanks in advance,
>> >
>> > James
>> >
>>
>
>

Re: Simple example

Posted by James Green <ja...@gmail.com>.
I changed the factory line to the following:

        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
                "tcp://10.0.0.81:61616?broker.persistent=false");

In activemq.xml:

<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>

Our subnet is 10.0.0.0/24. I am .84, the test box is .81.

When I telnet to it from my Netbeans I get a load of garbage with "Activemq"
in the middle so I'm pretty sure it's responding. If I run Wireshark then
invoke the java app nothing occurs on the wire though.

I have switched on trace, and I have switched log4j to DEBUG for camel. I
can see the following in the log:

2011-07-11 10:39:06,561 | DEBUG | Route: route1 >>>
EventDrivenConsumerRoute[Endpoint[activemq://example.A] ->
Instrumentation:route[UnitOfWork(Channel[sendTo(Endpoint[activemq://example.B])])]]
| org.apache.camel.spring.SpringCamelContext | main
2011-07-11 10:39:06,561 | DEBUG | Starting consumer (order: 1000) on route:
route1 | org.apache.camel.spring.SpringCamelContext | main
2011-07-11 10:39:06,565 | DEBUG | Registered MBean with objectname:
org.apache.camel:context=ubuntu/camel-2,type=consumers,name=JmsConsumer(0x723704)
| org.apache.camel.management.DefaultManagementAgent | main
2011-07-11 10:39:06,565 | DEBUG | Starting consumer:
Consumer[activemq://example.A] | org.apache.camel.component.jms.JmsConsumer
| main
2011-07-11 10:39:06,567 | DEBUG | Established shared JMS Connection |
org.apache.camel.component.jms.JmsMessageListenerContainer | main
2011-07-11 10:39:06,568 | DEBUG | Resumed paused task:
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker@13e846f|
org.apache.camel.component.jms.JmsMessageListenerContainer | main
2011-07-11 10:39:06,580 | INFO  | Route: route1 started and consuming from:
Endpoint[activemq://example.A] | org.apache.camel.spring.SpringCamelContext
| main
2011-07-11 10:39:06,580 | DEBUG | Creating endpoint
uri=[spring-event://default], path=[default], parameters=[{}] |
org.apache.camel.impl.DefaultComponent | main
2011-07-11 10:39:06,580 | DEBUG | spring-event://default converted to
endpoint: Endpoint[spring-event://default] by component:
org.apache.camel.component.event.EventComponent@1cd04f1 |
org.apache.camel.spring.SpringCamelContext | main
2011-07-11 10:39:06,581 | DEBUG | Registered MBean with objectname:
org.apache.camel:context=ubuntu/camel-2,type=endpoints,name="spring-event://default"
| org.apache.camel.management.DefaultManagementAgent | main
2011-07-11 10:39:06,581 | INFO  | Total 1 routes, of which 1 is started. |
org.apache.camel.spring.SpringCamelContext | main
2011-07-11 10:39:06,582 | INFO  | Apache Camel 2.7.0 (CamelContext: camel)
started in 0.175 seconds | org.apache.camel.spring.SpringCamelContext | main

After which I run my app and nothing further is logged.

James

On 11 July 2011 09:48, Charles Moulliard <cm...@gmail.com> wrote:

> Hi,
>
> Can you show us the configuration that you use to connect to activemq
> broker ? Maybe you connect to a local in memory instance using VM
> Transport protocol created when Camel starts and removed during the
> shutdown process. This is perhaps why you don't see anything in your
> ActiveMQ broker's queue.
>
> Use also Trace option of Camel = "true" to display more info in the log
> file
>
> <camelContext trace="true" ...
>
> Regards,
>
> Charles Moulliard
>
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
>
>
> On Mon, Jul 11, 2011 at 10:42 AM, James Green <ja...@gmail.com>
> wrote:
> > Hi,
> >
> > Is it expected that a Netbeans Java (Maven) app can copy/paste the simple
> > example source code and run when configured to connect against an
> existing
> > ActiveMQ instance?
> >
> > I must be doing something blindingly stupid, as it fails without any
> > exception for me!
> >
> > I am connecting against my development ActiveMQ instance and telnetting
> to
> > it's port responds just fine. My output is below. Nothing appears in the
> > ActiveMQ web console for test.queue (queues are normally dynamically
> > created). What on earth am I not doing right?
> >
> > SLF4J: The requested version 1.6 by your slf4j binding is not compatible
> > with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
> > SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further
> > details.
> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> > 2.7.2 (CamelContext: camel-1) is starting
> > 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
> > Using ManagedManagementStrategy.
> > 874 [main] INFO
> > org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 7
> > packages with 17 @Converter classes to load
> > 906 [main] WARN org.apache.camel.impl.converter.DefaultTypeConverter -
> > Overriding type converter from: StaticMethodTypeConverter: public static
> > org.apache.activemq.command.ActiveMQDestination
> >
> org.apache.camel.component.activemq.ActiveMQConverter.toDestination(java.lang.String)
> > to: StaticMethodTypeConverter: public static
> > org.apache.activemq.command.ActiveMQDestination
> >
> org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
> > 906 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
> > Loaded 152 type converters in 0.516 seconds
> > log4j:WARN No appenders could be found for logger
> > (org.springframework.jms.listener.DefaultMessageListenerContainer).
> > log4j:WARN Please initialize the log4j system properly.
> > 1296 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
> route1
> > started and consuming from: Endpoint[test-jms://queue:test.queue]
> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route:
> route2
> > started and consuming from: Endpoint[file://test]
> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2
> routes,
> > of which 2 is started.
> > 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> > 2.7.2 (CamelContext: camel-1) started in 1.078 seconds
> > Sent 0 to test.queue
> > Sent 1 to test.queue
> > Sent 2 to test.queue
> > Sent 3 to test.queue
> > Sent 4 to test.queue
> > Sent 5 to test.queue
> > Sent 6 to test.queue
> > Sent 7 to test.queue
> > Sent 8 to test.queue
> > Sent 9 to test.queue
> > 2327 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> > 2.7.2 (CamelContext:camel-1) is shutting down
> > 2327 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Starting
> to
> > graceful shutdown 2 routes (timeout 300 seconds)
> > 2327 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 suspended
> and
> > shutdown deferred, was consuming from: Endpoint[file://test]
> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
> > complete, was consuming from: Endpoint[test-jms://queue:test.queue]
> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 preparing
> to
> > shutdown complete.
> > 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> > org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 shutdown
> > complete.
> > 6310 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Graceful
> > shutdown of 2 routes completed in 3 seconds
> > 6310 [main] INFO org.apache.camel.impl.DefaultInflightRepository -
> Shutting
> > down with no inflight exchanges.
> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime:
> 6.076
> > seconds
> > 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> > 2.7.2 (CamelContext: camel-1) is shutdown in 3.983 seconds
> >
> > Thanks in advance,
> >
> > James
> >
>

Re: Simple example

Posted by Charles Moulliard <cm...@gmail.com>.
Hi,

Can you show us the configuration that you use to connect to activemq
broker ? Maybe you connect to a local in memory instance using VM
Transport protocol created when Camel starts and removed during the
shutdown process. This is perhaps why you don't see anything in your
ActiveMQ broker's queue.

Use also Trace option of Camel = "true" to display more info in the log file

<camelContext trace="true" ...

Regards,

Charles Moulliard

Apache Committer

Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard



On Mon, Jul 11, 2011 at 10:42 AM, James Green <ja...@gmail.com> wrote:
> Hi,
>
> Is it expected that a Netbeans Java (Maven) app can copy/paste the simple
> example source code and run when configured to connect against an existing
> ActiveMQ instance?
>
> I must be doing something blindingly stupid, as it fails without any
> exception for me!
>
> I am connecting against my development ActiveMQ instance and telnetting to
> it's port responds just fine. My output is below. Nothing appears in the
> ActiveMQ web console for test.queue (queues are normally dynamically
> created). What on earth am I not doing right?
>
> SLF4J: The requested version 1.6 by your slf4j binding is not compatible
> with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
> SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further
> details.
> 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.7.2 (CamelContext: camel-1) is starting
> 234 [main] INFO org.apache.camel.impl.DefaultCamelContext - JMX enabled.
> Using ManagedManagementStrategy.
> 874 [main] INFO
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader - Found 7
> packages with 17 @Converter classes to load
> 906 [main] WARN org.apache.camel.impl.converter.DefaultTypeConverter -
> Overriding type converter from: StaticMethodTypeConverter: public static
> org.apache.activemq.command.ActiveMQDestination
> org.apache.camel.component.activemq.ActiveMQConverter.toDestination(java.lang.String)
> to: StaticMethodTypeConverter: public static
> org.apache.activemq.command.ActiveMQDestination
> org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
> 906 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter -
> Loaded 152 type converters in 0.516 seconds
> log4j:WARN No appenders could be found for logger
> (org.springframework.jms.listener.DefaultMessageListenerContainer).
> log4j:WARN Please initialize the log4j system properly.
> 1296 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1
> started and consuming from: Endpoint[test-jms://queue:test.queue]
> 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route2
> started and consuming from: Endpoint[file://test]
> 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes,
> of which 2 is started.
> 1312 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.7.2 (CamelContext: camel-1) started in 1.078 seconds
> Sent 0 to test.queue
> Sent 1 to test.queue
> Sent 2 to test.queue
> Sent 3 to test.queue
> Sent 4 to test.queue
> Sent 5 to test.queue
> Sent 6 to test.queue
> Sent 7 to test.queue
> Sent 8 to test.queue
> Sent 9 to test.queue
> 2327 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.7.2 (CamelContext:camel-1) is shutting down
> 2327 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Starting to
> graceful shutdown 2 routes (timeout 300 seconds)
> 2327 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 suspended and
> shutdown deferred, was consuming from: Endpoint[file://test]
> 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
> complete, was consuming from: Endpoint[test-jms://queue:test.queue]
> 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 preparing to
> shutdown complete.
> 6310 [Camel (camel-1) thread #1 - ShutdownTask] INFO
> org.apache.camel.impl.DefaultShutdownStrategy - Route: route2 shutdown
> complete.
> 6310 [main] INFO org.apache.camel.impl.DefaultShutdownStrategy - Graceful
> shutdown of 2 routes completed in 3 seconds
> 6310 [main] INFO org.apache.camel.impl.DefaultInflightRepository - Shutting
> down with no inflight exchanges.
> 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Uptime: 6.076
> seconds
> 6310 [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel
> 2.7.2 (CamelContext: camel-1) is shutdown in 3.983 seconds
>
> Thanks in advance,
>
> James
>