FWIW the history behind this is to mirror AOP frameworks; where an
interceptor decides when and how to proceed with an interceptor - if
at all.
e.g. you may only want to proceed if a certain filter matches, so the
interceptor might be...
filter().el("${foo.bar}").proceed()
Or you could loop around a proceed() with a try/catch or whatever
I guess a normal use case of an interceptor in a Camel context is
gonna be doing something before or after a step evaluates - so an
interceptor should usually have a proceed at some point.
I would have thought its rare that any interceptor would just gobble
up an exchange; so we could maybe add a default proceed if there is
none - and support notProceed()?
Or maybe we just log a warning if someone makes an interceptor without
a proceed()?
On 21/04/2008, Hiram Chirino <[EMAIL PROTECTED]> wrote:
> +1
>
>
> On Mon, Apr 21, 2008 at 8:44 AM, Jonathan Anstey <[EMAIL PROTECTED]> wrote:
> > Hmmm.. maybe it was implemented in this way because supporting *not*
> proceed
> > in the DSL is even less intuitive! ;)
> >
> > Seriously though, out of those ideas I would prefer the intercept(false)
> > syntax.
> >
> >
> >
> > Cheers,
> > Jon
> >
> > Claus Ibsen wrote:
> >
> > > Hi
> > >
> > > That would potentially break the API but of course it would be more
> > intuitive.
> > >
> > > But then again we need to be able to NOT proceed and how should the user
> > specify this behaviour?
> > >
> > > Some DSL ideas:
> > > intercept().to("direct:killer").notProceed();
> > > intercept().to("direct:killer").stop();
> > > intercept().to("direct:killer").end();
> > > intercept(false).to("direct:killer");
> > >
> > > Any thoughts?
> > >
> > >
> > > Med venlig hilsen
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > >
> > > -----Original Message-----
> > > From: Jonathan Anstey [mailto:[EMAIL PROTECTED] Sent: 15. april 2008
> > 19:17
> > > To: [email protected]
> > > Subject: Re: interceptors - something is terrible wrong
> > >
> > > Yeah, I agree. Its more intuitive without the proceed()... I wonder if
> > there was a good reason for it being implemented in this way?
> > >
> > > Hiram Chirino wrote:
> > >
> > >
> > > > wouldn't most folks want to proceed() when intercepting? Should we
> > > > not make that the default behavior without having to specify
> > > > proceed()?
> > > >
> > > > On Sun, Apr 13, 2008 at 11:47 PM, Claus Ibsen <[EMAIL PROTECTED]>
> > wrote:
> > > >
> > > >
> > > > > Hi Jonathan
> > > > >
> > > > > Thanks a lot for the patch. I thought about the proceed method as
> > well but since it didn't work I assumed I was wrong as well. I couldn't
> > imagine the "standard logging / kinda like AOP logging" feature was
> > malfunction in Camel.
> > > > >
> > > > > I will get the patch in the SVN asap, and fix the wiki.
> > > > >
> > > > >
> > > > > Med venlig hilsen
> > > > >
> > > > > Claus Ibsen
> > > > > ......................................
> > > > > Silverbullet
> > > > > Skovsgårdsvænget 21
> > > > > 8362 Hørning
> > > > > Tlf. +45 2962 7576
> > > > > Web: www.silverbullet.dk
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: janstey [mailto:[EMAIL PROTECTED]
> > > > > Sent: 14. april 2008 02:44
> > > > > To: [email protected]
> > > > > Subject: Re: interceptors - something is terrible wrong
> > > > >
> > > > >
> > > > > Hey Claus,
> > > > >
> > > > > AFAIK you need to add a proceed() at the end of an intercept() route
> > or, as
> > > > > you described, it swallows the exchange. I found a little bug in the
> > > > > proceed() method as well... but this patch should fix it up.
> > > > > http://www.nabble.com/file/p16669908/intercept.patch intercept.patch
> > > > >
> > > > > Cheers,
> > > > > Jon
> > > > >
> > > > >
> > > > > Claus Ibsen wrote:
> > > > > >
> > > > > > Hi
> > > > > >
> > > > > >
> > > > > >
> > > > > > Sorry for the title but I needed to get your attention.
> > > > > >
> > > > > >
> > > > > >
> > > > > > On the wiki: http://activemq.apache.org/camel/dsl.html
> > > > > >
> > > > > > The interceptor sample is a good old logging sample that looks
> > plausible
> > > > > > and easy to understand. If you add intercept("log:mylogger") then
> > Camel
> > > > > > would log all the transitions.
> > > > > >
> > > > > >
> > > > > >
> > > > > > But the terrible part is that the logging example does not work as
> > stated.
> > > > > > In Camel if the interceptor kicks in it "swallows" the exchange
> and
> > the
> > > > > > exchange is not routed further.
> > > > > >
> > > > > >
> > > > > >
> > > > > > I have added a unit test to the came-core:
> > > > > > org.apache.camel.issues.InterceptorLogTest that demonstrates the
> > problem.
> > > > > >
> > > > > >
> > > > > >
> > > > > > If you enable the intercept() codeline the unit test fails.
> > > > > >
> > > > > >
> > > > > >
> > > > > > What is the fundamental usage for interceptors in Camel?
> > > > > >
> > > > > > The use case from an end user was to log all the steps so he could
> > get an
> > > > > > idea how the exchanges was actually routed - a great feature in my
> > mind.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > I have created a ticket CAMEL-442 to improve the documentation for
> > > > > > interceptors. I think the interceptor concept should be on its own
> > page,
> > > > > > so its easier to find in the current documentation.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Med venlig hilsen
> > > > > >
> > > > > >
> > > > > >
> > > > > > Claus Ibsen
> > > > > >
> > > > > > ......................................
> > > > > >
> > > > > > Silverbullet
> > > > > >
> > > > > > Skovsgårdsvænget 21
> > > > > >
> > > > > > 8362 Hørning
> > > > > >
> > > > > > Tlf. +45 2962 7576
> > > > > >
> > > > > > Web: www.silverbullet.dk
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> >
> http://www.nabble.com/interceptors---something-is-terrible-wrong-tp16661322s22882p16669908.html
> > > > > Sent from the Camel - Development mailing list archive at
> Nabble.com.
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>
>
>
> --
> Regards,
> Hiram
>
> Blog: http://hiramchirino.com
>
> Open Source SOA
> http://open.iona.com
>
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com