You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rintcius <ri...@rintcius.nl> on 2008/04/03 16:43:31 UTC
Some questions about a simple setHeader test
Hi,
I have just written some unit tests as a little proof of concept for Camel.
I will include this file separately.
This is roughly what I did:
First I tried out camel 1.2.0 where I encountered something using an
interceptor that I couldnt explain.
Then I switched to HEAD and noticed that it roughly behaves the same
regarding interceptors. But also I couldn't get groovy working on HEAD. See
the attached file for the specific failures and further notes.
So here are my questions:
- am I missing something regarding interceptors? (i.e. how to change the
tests testInterceptorBefore and testInterceptorAfter so that they succeed)
- what could be causing the failures on HEAD in the groovy tests? (just some
thoughts: changes in the setup, classpath issue, something broken on head)
I will upload the test case now.
Thanks for any help,
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16467528.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Some questions about a simple setHeader test
Posted by Rintcius <ri...@rintcius.nl>.
Ok thanks a lot, Claus
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16489090.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Some questions about a simple setHeader test
Posted by davsclaus <ci...@yahoo.dk>.
Hi Rin
I created a ticket in our issue tracker JIRA for your question/issue.
https://issues.apache.org/activemq/browse/CAMEL-437
Not you issue has been registered and we do not forget about it.
/Claus
Rintcius wrote:
>
> Hi,
> I have just written some unit tests as a little proof of concept for
> Camel. I will include this file separately.
> This is roughly what I did:
> First I tried out camel 1.2.0 where I encountered something using an
> interceptor that I couldnt explain.
> Then I switched to HEAD and noticed that it roughly behaves the same
> regarding interceptors. But also I couldn't get groovy working on HEAD.
> See the attached file for the specific failures and further notes.
>
> So here are my questions:
> - am I missing something regarding interceptors? (i.e. how to change the
> tests testInterceptorBefore and testInterceptorAfter so that they succeed)
> - what could be causing the failures on HEAD in the groovy tests? (just
> some thoughts: changes in the setup, classpath issue, something broken on
> head)
>
> I will upload the test case now.
>
> Thanks for any help,
> Rintcius http://www.nabble.com/file/p16467528/SimpleSetHeaderTest.java
> SimpleSetHeaderTest.java
>
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16486807.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Some questions about a simple setHeader test
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Rinticius
Thanks for spotting the odd behavior with the logging example.
Thanks to you we got it patched, unfortunately not in 1.3 but in the next release.
I have a odd thing for easy of use and no surprises. So when Camel was not up to the task of doing a simple logging interceptor then it should be fixed.
We love contributions and if you feel you have some ideas and improvements how the documentation could be improved, let us know
http://activemq.apache.org/camel/contributing.html
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Rintcius [mailto:rintcius@rintcius.nl]
Sent: 14. april 2008 12:09
To: camel-user@activemq.apache.org
Subject: RE: Some questions about a simple setHeader test
Ok, thanks for your help Claus. That makes it clear how it is implemented in
camel.
Maybe it is an idea to bring the other points about interceptors that I
mentioned to that separate thread that you are intending to create.
I also did a search on "intercept mule aop" to see whether (and how) mule
had something like this. See
http://docs.huihoo.com/soa/mule/1.3/Interceptors.html
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16675246.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Some questions about a simple setHeader test
Posted by Rintcius <ri...@rintcius.nl>.
Ok, thanks for your help Claus. That makes it clear how it is implemented in
camel.
Maybe it is an idea to bring the other points about interceptors that I
mentioned to that separate thread that you are intending to create.
I also did a search on "intercept mule aop" to see whether (and how) mule
had something like this. See
http://docs.huihoo.com/soa/mule/1.3/Interceptors.html
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16675246.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Some questions about a simple setHeader test
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi
Just a quick reply about the before and after issue.
The order in the route has a meaning. So in the before the inteceptor is
active for the routes below.
In after the interceptor is only active for the routes below and there are no routs so the interceptor never kicks in.
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Rintcius [mailto:rintcius@rintcius.nl]
Sent: 12. april 2008 13:17
To: camel-user@activemq.apache.org
Subject: RE: Some questions about a simple setHeader test
Hm, interesting... I looked up the definition of "to intercept":
#1 seize on its way; "The fighter plane was ordered to intercept an aircraft
that had entered the country's airspace"
#2 wiretap: tap a telephone or telegraph wire to get information; "The FBI
was tapping the phone line of the suspected spy"; "Is this hotel room
bugged?"
It looks like you are interpreting it as #1 whereas the documentation (and
I) interpreted is as #2.
To me #2 looks more useful, especially when intersect is being called
without a predicate (i.e. intercept everything). This is also what I used in
the test. If it intercepts everything as in #1 then what is the use of
building the route?
And interpreting it as #1, I still don't fully understand my test cases: Why
are there differences between interceptBefore and interceptAfter? Well, I
can see it from the viewpoint of how camel must have implemented it. It
looks like camel takes the first one in the built route, but it doesn't
really make sense to me from a functional viewpoint.
It is very well possible that I am missing a point here, but I like to learn
what that point is :)
And - as a sidepoint - actually what I was looking for when I stumbled on
intercept was something similar to the intercept concept in AOP. So
something general that could be plugged in, in an easy way.
Step(x) -> Interceptor -> Step(x+1)
So not an interceptor as an endpoint but one acting as a filter. In this
case you can decide in the interceptor whether you want to use it as #1 or
#2 (or change the body, add something to the header or whatever).
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16648405.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Some questions about a simple setHeader test
Posted by Rintcius <ri...@rintcius.nl>.
Hm, interesting... I looked up the definition of "to intercept":
#1 seize on its way; "The fighter plane was ordered to intercept an aircraft
that had entered the country's airspace"
#2 wiretap: tap a telephone or telegraph wire to get information; "The FBI
was tapping the phone line of the suspected spy"; "Is this hotel room
bugged?"
It looks like you are interpreting it as #1 whereas the documentation (and
I) interpreted is as #2.
To me #2 looks more useful, especially when intersect is being called
without a predicate (i.e. intercept everything). This is also what I used in
the test. If it intercepts everything as in #1 then what is the use of
building the route?
And interpreting it as #1, I still don't fully understand my test cases: Why
are there differences between interceptBefore and interceptAfter? Well, I
can see it from the viewpoint of how camel must have implemented it. It
looks like camel takes the first one in the built route, but it doesn't
really make sense to me from a functional viewpoint.
It is very well possible that I am missing a point here, but I like to learn
what that point is :)
And - as a sidepoint - actually what I was looking for when I stumbled on
intercept was something similar to the intercept concept in AOP. So
something general that could be plugged in, in an easy way.
Step(x) -> Interceptor -> Step(x+1)
So not an interceptor as an endpoint but one acting as a filter. In this
case you can decide in the interceptor whether you want to use it as #1 or
#2 (or change the body, add something to the header or whatever).
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16648405.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Some questions about a simple setHeader test
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Rintcius
#1
I think the interceptor documentation is wrong. It is an all or nothing strategy that if an exchange is intercepted it is not routed through the normal route path. The interceptor wiki documentation is unfortunately wrong here as it uses a step logging example.
I think that interceptors are used for snatching the exchange and diverting its path to something else. Not for logging the steps.
#2
If you need the log every steps example I do think the trace() expression is a step in that direction.
from("seda:a").trace("xxx").to("seda:b");
from("seda:b").trace("yyy").to("seda:c");
#3
I do think there should be a easy switch in Camel to turn on/off logging of the steps into a logging category of your choice so you can use it for tracking what is going on. I will raise a JIRA for this.
#4
I did not test the groovy as I was testing the code in camel-core where camel-groovy is not a part of.
I will try the groovy case to see what is going on.
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Rintcius [mailto:rintcius@rintcius.nl]
Sent: 12. april 2008 11:08
To: camel-user@activemq.apache.org
Subject: Re: Some questions about a simple setHeader test
Thanks for looking at it, Claus.
Yes, I still have the same problem with interceptors. That is, what is
documented at http://activemq.apache.org/camel/dsl.html looks good (i.e.
usable) to me and that is what I meant to assert in the unit test. So I am
curious what you think is wrong about the interceptor documentation.
I don't have a real life use case yet, because I am still in evaluation
phase, but to mention an example, I thought it would be useful for
logging/debugging, to see what's happening at each step. So what I am seeing
in the unit test is not what I would expect, since it changes the delivery
of messages in ways that I cannot explain. (I expected camel interceptors to
act analogous to interceptors in AOP)
So are you saying that the groovy tests are running ok in your environment?
I can imagine that they are failing because of something in my environment
but I think it's weird that there's no stacktrace or error message. (Just
tried it again on HEAD after an update and they are still failing)
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16647704.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Some questions about a simple setHeader test
Posted by Rintcius <ri...@rintcius.nl>.
Thanks for looking at it, Claus.
Yes, I still have the same problem with interceptors. That is, what is
documented at http://activemq.apache.org/camel/dsl.html looks good (i.e.
usable) to me and that is what I meant to assert in the unit test. So I am
curious what you think is wrong about the interceptor documentation.
I don't have a real life use case yet, because I am still in evaluation
phase, but to mention an example, I thought it would be useful for
logging/debugging, to see what's happening at each step. So what I am seeing
in the unit test is not what I would expect, since it changes the delivery
of messages in ways that I cannot explain. (I expected camel interceptors to
act analogous to interceptors in AOP)
So are you saying that the groovy tests are running ok in your environment?
I can imagine that they are failing because of something in my environment
but I think it's weird that there's no stacktrace or error message. (Just
tried it again on HEAD after an update and they are still failing)
Rintcius
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16647704.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Some questions about a simple setHeader test
Posted by davsclaus <ci...@yahoo.dk>.
I had a few moments to look at it.
At first glance it doesnt look like a problem in Camel. However I do think
the interceptor documentation is wrong.
I will raise a new thread in the forum for discussion how the interceptors
is to be used. And we need to improve the interceptor documentation (already
a ticket for this).
Rintcius do you still have a problem with Camel using interceptors? Do you
have a real life use-case that is causing some problems?
/Claus
--
View this message in context: http://www.nabble.com/Some-questions-about-a-simple-setHeader-test-tp16467528s22882p16646197.html
Sent from the Camel - Users mailing list archive at Nabble.com.