camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <>
Subject Re: adding Bindings to Endpoints...
Date Sun, 21 Oct 2012 10:58:38 GMT
Hi James,

The idea looks nice. I'm just a bit concerned about whether the concept
steps on the toes of the interceptSendToEndpoint DSL to some extent?

The interceptSTE DSL only triggers at the dispatch stage, not at the
response, so it doesn't _fully wrap_ it. Perhaps we could extend the
interceptSTE to provide a syntax like this:

<interceptSendToEndpoint uri="seda:issueTicket">
      <log message="Intercepted: ${body}" />
      <bean ref="abc" method="def" />
      <!-- only trigger if condition is true -->
      <xpath>/airline = 'Camel Airlines'</xpath>
      <log message="Intercepted response: ${body}" />

If I'm not mistaken, this shortcoming exists ever since the AOP DSL was
deprecated [1]?

Anyway, back to Bindings. The concept is top notch, but it may confuse
users to find so many ways in Camel of doing similar stuff (Binding,
Intercept, EventNotifiers, etc.).

IMHO, the benefits of Bindings against interceptSTE are the following:

   - Definition is local to the endpoint  => with bindings, the
   before/after logic is defined closer to the endpoint; interceptors are
   defined "further away" from the endpoint: in the Camel Context.
   - Due to above, code readability and clarity may be better with Bindings
   in some cases, as the user doesn't have to dot back and forth to get the
   full picture.
   - Before / after semantics => interceptSTE cannot define actions after
   the endpoint dispatch returns
   - With Bindings, full interception logic (before, after) can be
   encapsulated inside a single Java class. With interceptSTE it's not
   possible. Maybe we can provide a syntax like

<interceptSendToEndpoint uri="..." interceptorRef="myInterceptor" />

Where myInterceptor implements an Interceptor interface with before() and
after() methods.



*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist | | twitter: @raulvk <>

On Fri, Oct 19, 2012 at 12:13 PM, James Strachan

> Inspired by the SwitchYard project and how it uses contracts in SCA, I
> thought I'd take a stab at adding something vaguely similar to Camel;
> to allow us to add bindings to an endpoint (e.g. ensuring a particular
> Data Format is used in or out of the endpoint, to add a validation
> step , add transactions or whatnot).
> It turned out to be really simple ;) there's not really much in the
> way of code; its more a new concept (rather like the introduction of
> Data Format a long time ago). I've tried to document what Bindings are
> and how they can be used - and when to use them or not...
> I'm not sure how big a deal they are in general to Camel folks; if you
> only use an endpoint once inside a route and the route isn't used or
> shared by anything else, they are not that useful really. But I can
> see them being useful when folks have lots of endpoints; or wish to
> pass endpoints into and out of composite routes etc.
> So far there's only one Binding implementation ;) the
> DataFormatBinding which was pretty trivial to implement.
> Am sure we could hack up others for Java type conversion, XSD
> validation or WSDL contract enforcement or whatnot.
> We could also add a little bit of syntax sugar in the Java/XML DSLs to
> make them a little more DRY to use.
> Thoughts?
> --
> James
> -------
> Red Hat
> Email:
> Web:
> Twitter: jstrachan, fusenews
> Blog:
> Open Source Integration

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message