You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tommy Chheng <to...@gmail.com> on 2011/03/02 17:20:03 UTC

amazon sqs route shutting down?

I want to define a route to poll from an amazon SQS queue.
val context = new DefaultCamelContext(reg)
context.setHandleFault(true)
context.addRoutes(new RouteBuilder{
override def configure(){
from("aws-sqs://test_development?amazonSQSClient=#test_sqs").to("log:b")
}}
)
context.start
where test_sqs is in the registry for an AmazonSQSClient(credentials) object

It seems to connect fine but when I run it(using mvn exec:java -Dexec.mainClass), but it shutsdown immediately after.

DefaultCamelContext Route: route1 started and consuming from: Endpoint[aws-sqs://test_development?amazonSQSClient=%23test_sqs]

How can I prevent the process from immediately shuting down? I want the process to run to continously poll the SQS queue.

If I replace the aws-sqs queue with a local activemq, the camel application runs successfully until issued a shutdown command.
context.addComponent("activemq", ActiveMQComponent.activeMQComponent(Config.activeMqConnection))
from("activemq:queue:a").to("log:b")


-- 
@tommychheng
http://tommy.chheng.com


Re: amazon sqs route shutting down?

Posted by Tommy Chheng <to...@gmail.com>.
Thanks Claus, extending the MainSupport does fix the problem

-- 
@tommychheng
http://tommy.chheng.com

On Wednesday, March 2, 2011 at 8:22 AM, Claus Ibsen wrote: 
> See the Main class in camel-spring and/or camel-core.
> 
> 
> 
> 
> On Wed, Mar 2, 2011 at 5:20 PM, Tommy Chheng <to...@gmail.com> wrote:
> > I want to define a route to poll from an amazon SQS queue.
> > val context = new DefaultCamelContext(reg)
> > context.setHandleFault(true)
> > context.addRoutes(new RouteBuilder{
> > override def configure(){
> > from("aws-sqs://test_development?amazonSQSClient=#test_sqs").to("log:b")
> > }}
> > )
> > context.start
> > where test_sqs is in the registry for an AmazonSQSClient(credentials) object
> > 
> > It seems to connect fine but when I run it(using mvn exec:java -Dexec.mainClass), but it shutsdown immediately after.
> > 
> > DefaultCamelContext Route: route1 started and consuming from: Endpoint[aws-sqs://test_development?amazonSQSClient=%23test_sqs]
> > 
> > How can I prevent the process from immediately shuting down? I want the process to run to continously poll the SQS queue.
> > 
> > If I replace the aws-sqs queue with a local activemq, the camel application runs successfully until issued a shutdown command.
> > context.addComponent("activemq", ActiveMQComponent.activeMQComponent(Config.activeMqConnection))
> > from("activemq:queue:a").to("log:b")
> > 
> > 
> > --
> > @tommychheng
> > http://tommy.chheng.com
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
> 

Re: amazon sqs route shutting down?

Posted by Tommy Chheng <to...@gmail.com>.
I'm looking at http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Main.java?view=markup

Do I need to extends MainSupport?

On a side note, why does using an activemq endpoint prevent my sample app from shutting down? 

-- 
@tommychheng
http://tommy.chheng.com

On Wednesday, March 2, 2011 at 8:22 AM, Claus Ibsen wrote: 
> See the Main class in camel-spring and/or camel-core.
> 
> 
> 
> 
> On Wed, Mar 2, 2011 at 5:20 PM, Tommy Chheng <to...@gmail.com> wrote:
> > I want to define a route to poll from an amazon SQS queue.
> > val context = new DefaultCamelContext(reg)
> > context.setHandleFault(true)
> > context.addRoutes(new RouteBuilder{
> > override def configure(){
> > from("aws-sqs://test_development?amazonSQSClient=#test_sqs").to("log:b")
> > }}
> > )
> > context.start
> > where test_sqs is in the registry for an AmazonSQSClient(credentials) object
> > 
> > It seems to connect fine but when I run it(using mvn exec:java -Dexec.mainClass), but it shutsdown immediately after.
> > 
> > DefaultCamelContext Route: route1 started and consuming from: Endpoint[aws-sqs://test_development?amazonSQSClient=%23test_sqs]
> > 
> > How can I prevent the process from immediately shuting down? I want the process to run to continously poll the SQS queue.
> > 
> > If I replace the aws-sqs queue with a local activemq, the camel application runs successfully until issued a shutdown command.
> > context.addComponent("activemq", ActiveMQComponent.activeMQComponent(Config.activeMqConnection))
> > from("activemq:queue:a").to("log:b")
> > 
> > 
> > --
> > @tommychheng
> > http://tommy.chheng.com
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
> 

Re: amazon sqs route shutting down?

Posted by Claus Ibsen <cl...@gmail.com>.
See the Main class in camel-spring and/or camel-core.




On Wed, Mar 2, 2011 at 5:20 PM, Tommy Chheng <to...@gmail.com> wrote:
> I want to define a route to poll from an amazon SQS queue.
> val context = new DefaultCamelContext(reg)
> context.setHandleFault(true)
> context.addRoutes(new RouteBuilder{
> override def configure(){
> from("aws-sqs://test_development?amazonSQSClient=#test_sqs").to("log:b")
> }}
> )
> context.start
> where test_sqs is in the registry for an AmazonSQSClient(credentials) object
>
> It seems to connect fine but when I run it(using mvn exec:java -Dexec.mainClass), but it shutsdown immediately after.
>
> DefaultCamelContext Route: route1 started and consuming from: Endpoint[aws-sqs://test_development?amazonSQSClient=%23test_sqs]
>
> How can I prevent the process from immediately shuting down? I want the process to run to continously poll the SQS queue.
>
> If I replace the aws-sqs queue with a local activemq, the camel application runs successfully until issued a shutdown command.
> context.addComponent("activemq", ActiveMQComponent.activeMQComponent(Config.activeMqConnection))
> from("activemq:queue:a").to("log:b")
>
>
> --
> @tommychheng
> http://tommy.chheng.com
>
>



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