You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jannecamel <ja...@iki.fi> on 2013/06/06 16:07:41 UTC

idempotentConsumer is not idempotent?

At first look I was getting excited about idempotentConsumer - this would
help me nicely in creating idempotent services.

But looking closer, it does not seem to do what it says?

Looks like it takes first request and processes it. Then if duplicate
messages come, it just discards those.

A true idempotent consumer would discard the duplicate messages AND return
the same (cached) response as the first one got. For example if I have
service add(x,y) and I call add(2,5) multiple times, each call should return
7. Now first returns 7 and duplicate ones return nothing. Or did I
understand it wrong?

http://www.enterpriseintegrationpatterns.com/IdempotentReceiver.html
"The term idempotent is used in mathematics to describe a function that
produces the same result if it is applied to itself, i.e. f(x) = f(f(x)). In
Messaging this concepts translates into the a message that has the same
effect whether it is received once or multiple times. This means that a
message can safely be resent without causing any problems even if the
receiver receives duplicates of the same message."



--
View this message in context: http://camel.465427.n5.nabble.com/idempotentConsumer-is-not-idempotent-tp5733945.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: idempotentConsumer is not idempotent?

Posted by jannecamel <ja...@iki.fi>.
How in practice do (or do they?) people use idempotentConsumer when creating
"idempotent" web service interfaces?

Do they use idempotentConsumer only with one-way operations, do they have
have idempotentConsumer + some kind of hand made reply message caching with
request-response operations, or....?

Because I can't see how idempotentConsumer can be used if you have
request-response type of services, such as
updateThisAndThatAndShowResults(). In case of response message getting lost,
client would retry calling the idempotent service (which it can do as many
times as it wants) but would not get the response message.



--
View this message in context: http://camel.465427.n5.nabble.com/idempotentConsumer-is-not-idempotent-tp5733945p5733977.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: idempotentConsumer is not idempotent?

Posted by Chris Wolf <cw...@gmail.com>.
Although you may be wishing for a strict interpretation of
"idempotent", there are also practical interpretations, e.g.
the "idempotent" option for the "file://" component - the whole
purpose of this option is to read the file only once, even if it
remains in the directory.

On Thu, Jun 6, 2013 at 10:07 AM, jannecamel <ja...@iki.fi> wrote:
> At first look I was getting excited about idempotentConsumer - this would
> help me nicely in creating idempotent services.
>
> But looking closer, it does not seem to do what it says?
>
> Looks like it takes first request and processes it. Then if duplicate
> messages come, it just discards those.
>
> A true idempotent consumer would discard the duplicate messages AND return
> the same (cached) response as the first one got. For example if I have
> service add(x,y) and I call add(2,5) multiple times, each call should return
> 7. Now first returns 7 and duplicate ones return nothing. Or did I
> understand it wrong?
>
> http://www.enterpriseintegrationpatterns.com/IdempotentReceiver.html
> "The term idempotent is used in mathematics to describe a function that
> produces the same result if it is applied to itself, i.e. f(x) = f(f(x)). In
> Messaging this concepts translates into the a message that has the same
> effect whether it is received once or multiple times. This means that a
> message can safely be resent without causing any problems even if the
> receiver receives duplicates of the same message."
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/idempotentConsumer-is-not-idempotent-tp5733945.html
> Sent from the Camel - Users mailing list archive at Nabble.com.