You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pavel <pa...@gmail.com> on 2010/12/17 22:55:31 UTC

Idea for camel-scala DSL enhancement.

Folks,

I have an idea for period DSL enhancement in camel-scala that I want to get
your feedback on.
And a proposed implementation in
https://issues.apache.org/jira/browse/CAMEL-3439

Basically, there are 3 goals
* Support more time units - milliseconds to weeks
* Allow mixed units in period spec: 3 hours 20 minutes 30 seconds
* Internally remove/minimize duplication, so that units and relevant
transformations are defined in one place. Current codebase has these in
  - Period
  - RichInt
  - Frequency
  - SDelayDefinition (not sure if DSL uses these methods)
  - SThrottleDefinition (not sure if DSL uses these methods)

My implementation has a price - it requires DSL to always use period spec in
parentheses, so that scala compiler knows exactly where its definition
starts and ends.
Practically, it means no changes to "delay", and extra "()" for "throttle",
e.g.
* throttle (3 per (1 second))
* throttle (3 per (1 minute 30 seconds))

So, for you scala DSL users, does it sound like a useful enhancement and
reasonable tradeoff?

Thanks,
Pavel

RE: Camel stops listening to Queue

Posted by Michael La Budde <pa...@hotmail.com>.
> 
> PS: There are two servers running the server side of this - both will be monitoring the same Queue for the InOut messages. I can switch off one of the servers and see if that makes any difference...
> 

Well, turning off one of the two servers seems to have fixed the issue. I have not been able to reproduce it.

So, why would having multiple servers (and multiple consumers) listening on a queue result in InOut messages not being processed?

Is there some configuration setting I'm missing?

Should I be using an exclusive consumer to process InOut messages?

Any help would be greatly appreciated.

TIA,

Mike L. (aka patzerbud)

 		 	   		  

RE: Camel stops listening to Queue

Posted by Michael La Budde <pa...@hotmail.com>.
Thank you for your response. Yes, we are experiencing TimeoutExceptions when the server fails to respond within the (default) 20 seconds to an InOut message. 
I had high hopes that this would fix the issue - alas, it did not. 

Here is the connection string I'm using:

failover:(tcp://10.0.33.118:61616?keepAlive=true&trace=true,tcp://10.0.33.119:61616?keepAlive=true&trace=true)?randomize=false

This morning I changed the server application to use this:

tcp://10.0.33.118:61616?keepAlive=true&trace=true

Initial tests looked promising but then, once again, we have experienced the same Timeouts. Here's a partial stack trace: 

Caused by: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 20000 millis. Exchange[Message: <?xml version="1.0" encoding="UTF-8"?> ...snip...

I'm really at a loss as to what's happening and how to resolve this issue.

In order to gain some visibility I'm ready to enable debug logging for
org.apache.camel
org.springframework
org.apache.activemq

Any thoughts/information/suggestions would be most welcome!

TIA,

Mike L. (aka patzerbud)

PS: There are two servers running the server side of this - both will be monitoring the same Queue for the InOut messages. I can switch off one of the servers and see if that makes any difference...

> 
> Is it timing out?
> Have you tried specifying a keep alive parameter to activemq?
>     val activeMqConnection = "tcp://localhost:61616?keepAlive=true"
> 
> -
> @tommychheng
> http://tommy.chheng.com
> 
> On Tue, Dec 21, 2010 at 10:48 AM, Michael La Budde <pa...@hotmail.com>wrote:
> 
> >
> > Hi all:
> >
> > Here is what I am experiencing:
> >
> > After a period of time Camel stops pulling messages off a queue and
> > ActiveMQ moves them to the DLQ.
> >
> > Environment:
> >
> > Camel 2.4.0
> > Spring 3.0.5
> > ActiveMQ 5.3.1
> >
> > My Camel/Spring applications run inside JBoss on linux servers.
> >
> > The client application uses ProducerTemplate.requestBody(dest, xml) to send
> > an InOut message. The destination is something like:
> >
> > "activemq:MyCompany.CAM"
> >
> > The route on the server side looks like this:
> >
> > <route>
> >  <from uri="activemq:MyCompany.CAM?concurrentConsumers=2"/>
> >   <choice>
> >
> >  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userAssociated']</xpath>
> >      <to uri="bean:associateUser"/>
> >    </when>
> >
> >  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userChanged']</xpath>
> >      <to uri="bean:changeUser"/>
> >    </when>
> >
> >  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='checkAccount']</xpath>
> >      <to uri="bean:checkAccount"/>
> >    </when>
> >
> >  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='createUser']</xpath>
> >      <to uri="bean:createUser"/>
> >    </when>
> >    <otherwise>
> >        <to uri="bean:unknownMessage"/>
> >    </otherwise>
> >  </choice>
> > </route>
> >
> > Each bean implements the Processor interface and typically has only that
> > one method.
> >
> > Everything works well for awhile - but then the InOut messages are no
> > longer received.
> > They get published to ActiveMQ properly but after the 20 second timeout
> > (the default) they get moved to the DLQ.
> >
> > Before I write a servlet to handle the synchronous requests I thought I'd
> > check here to see if anyone could shed some light on what is going on and
> > how I can fix it.
> >
> > TIA,
> >
> > Mike L. (aka patzerbud)
> >
> >
 		 	   		  

Re: Camel stops listening to Queue

Posted by Tommy Chheng <to...@gmail.com>.
Is it timing out?
Have you tried specifying a keep alive parameter to activemq?
    val activeMqConnection = "tcp://localhost:61616?keepAlive=true"

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

On Tue, Dec 21, 2010 at 10:48 AM, Michael La Budde <pa...@hotmail.com>wrote:

>
> Hi all:
>
> Here is what I am experiencing:
>
> After a period of time Camel stops pulling messages off a queue and
> ActiveMQ moves them to the DLQ.
>
> Environment:
>
> Camel 2.4.0
> Spring 3.0.5
> ActiveMQ 5.3.1
>
> My Camel/Spring applications run inside JBoss on linux servers.
>
> The client application uses ProducerTemplate.requestBody(dest, xml) to send
> an InOut message. The destination is something like:
>
> "activemq:MyCompany.CAM"
>
> The route on the server side looks like this:
>
> <route>
>  <from uri="activemq:MyCompany.CAM?concurrentConsumers=2"/>
>   <choice>
>
>  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userAssociated']</xpath>
>      <to uri="bean:associateUser"/>
>    </when>
>
>  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userChanged']</xpath>
>      <to uri="bean:changeUser"/>
>    </when>
>
>  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='checkAccount']</xpath>
>      <to uri="bean:checkAccount"/>
>    </when>
>
>  <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='createUser']</xpath>
>      <to uri="bean:createUser"/>
>    </when>
>    <otherwise>
>        <to uri="bean:unknownMessage"/>
>    </otherwise>
>  </choice>
> </route>
>
> Each bean implements the Processor interface and typically has only that
> one method.
>
> Everything works well for awhile - but then the InOut messages are no
> longer received.
> They get published to ActiveMQ properly but after the 20 second timeout
> (the default) they get moved to the DLQ.
>
> Before I write a servlet to handle the synchronous requests I thought I'd
> check here to see if anyone could shed some light on what is going on and
> how I can fix it.
>
> TIA,
>
> Mike L. (aka patzerbud)
>
>

Camel stops listening to Queue

Posted by Michael La Budde <pa...@hotmail.com>.
Hi all:

Here is what I am experiencing: 

After a period of time Camel stops pulling messages off a queue and ActiveMQ moves them to the DLQ.

Environment:

Camel 2.4.0
Spring 3.0.5
ActiveMQ 5.3.1

My Camel/Spring applications run inside JBoss on linux servers.

The client application uses ProducerTemplate.requestBody(dest, xml) to send an InOut message. The destination is something like: 

"activemq:MyCompany.CAM"

The route on the server side looks like this:

<route>
  <from uri="activemq:MyCompany.CAM?concurrentConsumers=2"/>
   <choice>
    <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userAssociated']</xpath>
      <to uri="bean:associateUser"/>
    </when>
    <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='userChanged']</xpath>
      <to uri="bean:changeUser"/>
    </when>
    <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='checkAccount']</xpath>
      <to uri="bean:checkAccount"/>
    </when>
    <when><xpath>/MyCompanyMessage/MessageHeader[MessageType='createUser']</xpath>
      <to uri="bean:createUser"/>
    </when>
    <otherwise>
        <to uri="bean:unknownMessage"/>
    </otherwise>
  </choice>
</route>

Each bean implements the Processor interface and typically has only that one method.

Everything works well for awhile - but then the InOut messages are no longer received. 
They get published to ActiveMQ properly but after the 20 second timeout (the default) they get moved to the DLQ.

Before I write a servlet to handle the synchronous requests I thought I'd check here to see if anyone could shed some light on what is going on and how I can fix it.

TIA,

Mike L. (aka patzerbud)

 		 	   		  

Re: Idea for camel-scala DSL enhancement.

Posted by Pavel <pa...@gmail.com>.
Take a look at *CAMEL-3491<https://issues.apache.org/jira/browse/CAMEL-3491> -
it is proposed DSL enhancement that I was able to come up with; patch and
examples are in jira.*

Thanks,
Pavel
On Thu, Dec 23, 2010 at 4:55 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Dec 21, 2010 at 7:29 PM, Pavel <pa...@gmail.com> wrote:
> > Cool; I guess then for this topic I'm missing a review from core
> committers
> > (Gert, are you around?), so that I could address feedback. And propose
> docs
> > then.
> >
> > IMO the next logical and handy DSL enhancement would be introduction of
> > "every(period)", as alias for
> > "from(timer:someGeneratedName?period=equivalentInMs)"
> >
>
> In Camel 3.x we will work on adding some form of schedule DSL to
> camel-core so you can kinda define a route to trigger every X using
> some sort of DSL. And support CRON as well. Then you can plugin a CRON
> provider such as Quartz, or Spring 3.x which may have a CRON parser as
> well.
>
> There is a ticket for this in JIRA.
>
> But getting a head start in the scala DSL would be great, then we may
> get settled on a nice DSL for that, we can port into camel-core when
> its time for that.
>
> > Thanks,
> > Pavel
> >
> > On Mon, Dec 20, 2010 at 8:20 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> Hi Pavel
> >>
> >> Great work. We would love help and contributions with the Scala DSL.
> >> I think we should ty to unify how you specify period / time as you
> suggest.
> >>
> >> And I dont mind the trade off, so please continue your work.
> >> I am sure you will even be able to find other spots in the Scala DSL
> >> which could be improved.
> >>
> >>
> >>
> >> On Fri, Dec 17, 2010 at 10:55 PM, Pavel <pa...@gmail.com> wrote:
> >> > Folks,
> >> >
> >> > I have an idea for period DSL enhancement in camel-scala that I want
> to
> >> get
> >> > your feedback on.
> >> > And a proposed implementation in
> >> > https://issues.apache.org/jira/browse/CAMEL-3439
> >> >
> >> > Basically, there are 3 goals
> >> > * Support more time units - milliseconds to weeks
> >> > * Allow mixed units in period spec: 3 hours 20 minutes 30 seconds
> >> > * Internally remove/minimize duplication, so that units and relevant
> >> > transformations are defined in one place. Current codebase has these
> in
> >> >  - Period
> >> >  - RichInt
> >> >  - Frequency
> >> >  - SDelayDefinition (not sure if DSL uses these methods)
> >> >  - SThrottleDefinition (not sure if DSL uses these methods)
> >> >
> >> > My implementation has a price - it requires DSL to always use period
> spec
> >> in
> >> > parentheses, so that scala compiler knows exactly where its definition
> >> > starts and ends.
> >> > Practically, it means no changes to "delay", and extra "()" for
> >> "throttle",
> >> > e.g.
> >> > * throttle (3 per (1 second))
> >> > * throttle (3 per (1 minute 30 seconds))
> >> >
> >> > So, for you scala DSL users, does it sound like a useful enhancement
> and
> >> > reasonable tradeoff?
> >> >
> >> > Thanks,
> >> > Pavel
> >> >
> >>
> >>
> >>
> >> --
> >> 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/
> >>
> >
>
>
>
> --
> 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: Idea for camel-scala DSL enhancement.

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Dec 21, 2010 at 7:29 PM, Pavel <pa...@gmail.com> wrote:
> Cool; I guess then for this topic I'm missing a review from core committers
> (Gert, are you around?), so that I could address feedback. And propose docs
> then.
>
> IMO the next logical and handy DSL enhancement would be introduction of
> "every(period)", as alias for
> "from(timer:someGeneratedName?period=equivalentInMs)"
>

In Camel 3.x we will work on adding some form of schedule DSL to
camel-core so you can kinda define a route to trigger every X using
some sort of DSL. And support CRON as well. Then you can plugin a CRON
provider such as Quartz, or Spring 3.x which may have a CRON parser as
well.

There is a ticket for this in JIRA.

But getting a head start in the scala DSL would be great, then we may
get settled on a nice DSL for that, we can port into camel-core when
its time for that.

> Thanks,
> Pavel
>
> On Mon, Dec 20, 2010 at 8:20 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi Pavel
>>
>> Great work. We would love help and contributions with the Scala DSL.
>> I think we should ty to unify how you specify period / time as you suggest.
>>
>> And I dont mind the trade off, so please continue your work.
>> I am sure you will even be able to find other spots in the Scala DSL
>> which could be improved.
>>
>>
>>
>> On Fri, Dec 17, 2010 at 10:55 PM, Pavel <pa...@gmail.com> wrote:
>> > Folks,
>> >
>> > I have an idea for period DSL enhancement in camel-scala that I want to
>> get
>> > your feedback on.
>> > And a proposed implementation in
>> > https://issues.apache.org/jira/browse/CAMEL-3439
>> >
>> > Basically, there are 3 goals
>> > * Support more time units - milliseconds to weeks
>> > * Allow mixed units in period spec: 3 hours 20 minutes 30 seconds
>> > * Internally remove/minimize duplication, so that units and relevant
>> > transformations are defined in one place. Current codebase has these in
>> >  - Period
>> >  - RichInt
>> >  - Frequency
>> >  - SDelayDefinition (not sure if DSL uses these methods)
>> >  - SThrottleDefinition (not sure if DSL uses these methods)
>> >
>> > My implementation has a price - it requires DSL to always use period spec
>> in
>> > parentheses, so that scala compiler knows exactly where its definition
>> > starts and ends.
>> > Practically, it means no changes to "delay", and extra "()" for
>> "throttle",
>> > e.g.
>> > * throttle (3 per (1 second))
>> > * throttle (3 per (1 minute 30 seconds))
>> >
>> > So, for you scala DSL users, does it sound like a useful enhancement and
>> > reasonable tradeoff?
>> >
>> > Thanks,
>> > Pavel
>> >
>>
>>
>>
>> --
>> 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/
>>
>



-- 
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: Idea for camel-scala DSL enhancement.

Posted by Pavel <pa...@gmail.com>.
Cool; I guess then for this topic I'm missing a review from core committers
(Gert, are you around?), so that I could address feedback. And propose docs
then.

IMO the next logical and handy DSL enhancement would be introduction of
"every(period)", as alias for
"from(timer:someGeneratedName?period=equivalentInMs)"

Thanks,
Pavel

On Mon, Dec 20, 2010 at 8:20 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi Pavel
>
> Great work. We would love help and contributions with the Scala DSL.
> I think we should ty to unify how you specify period / time as you suggest.
>
> And I dont mind the trade off, so please continue your work.
> I am sure you will even be able to find other spots in the Scala DSL
> which could be improved.
>
>
>
> On Fri, Dec 17, 2010 at 10:55 PM, Pavel <pa...@gmail.com> wrote:
> > Folks,
> >
> > I have an idea for period DSL enhancement in camel-scala that I want to
> get
> > your feedback on.
> > And a proposed implementation in
> > https://issues.apache.org/jira/browse/CAMEL-3439
> >
> > Basically, there are 3 goals
> > * Support more time units - milliseconds to weeks
> > * Allow mixed units in period spec: 3 hours 20 minutes 30 seconds
> > * Internally remove/minimize duplication, so that units and relevant
> > transformations are defined in one place. Current codebase has these in
> >  - Period
> >  - RichInt
> >  - Frequency
> >  - SDelayDefinition (not sure if DSL uses these methods)
> >  - SThrottleDefinition (not sure if DSL uses these methods)
> >
> > My implementation has a price - it requires DSL to always use period spec
> in
> > parentheses, so that scala compiler knows exactly where its definition
> > starts and ends.
> > Practically, it means no changes to "delay", and extra "()" for
> "throttle",
> > e.g.
> > * throttle (3 per (1 second))
> > * throttle (3 per (1 minute 30 seconds))
> >
> > So, for you scala DSL users, does it sound like a useful enhancement and
> > reasonable tradeoff?
> >
> > Thanks,
> > Pavel
> >
>
>
>
> --
> 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: Idea for camel-scala DSL enhancement.

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

Great work. We would love help and contributions with the Scala DSL.
I think we should ty to unify how you specify period / time as you suggest.

And I dont mind the trade off, so please continue your work.
I am sure you will even be able to find other spots in the Scala DSL
which could be improved.



On Fri, Dec 17, 2010 at 10:55 PM, Pavel <pa...@gmail.com> wrote:
> Folks,
>
> I have an idea for period DSL enhancement in camel-scala that I want to get
> your feedback on.
> And a proposed implementation in
> https://issues.apache.org/jira/browse/CAMEL-3439
>
> Basically, there are 3 goals
> * Support more time units - milliseconds to weeks
> * Allow mixed units in period spec: 3 hours 20 minutes 30 seconds
> * Internally remove/minimize duplication, so that units and relevant
> transformations are defined in one place. Current codebase has these in
>  - Period
>  - RichInt
>  - Frequency
>  - SDelayDefinition (not sure if DSL uses these methods)
>  - SThrottleDefinition (not sure if DSL uses these methods)
>
> My implementation has a price - it requires DSL to always use period spec in
> parentheses, so that scala compiler knows exactly where its definition
> starts and ends.
> Practically, it means no changes to "delay", and extra "()" for "throttle",
> e.g.
> * throttle (3 per (1 second))
> * throttle (3 per (1 minute 30 seconds))
>
> So, for you scala DSL users, does it sound like a useful enhancement and
> reasonable tradeoff?
>
> Thanks,
> Pavel
>



-- 
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/