You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "fabrizio.spataro" <fa...@bizmate.it> on 2015/09/10 12:57:37 UTC

Interceptor into external file

Hello,

i would use same interceptor (XML Spring implementation) into my different
projects.

Can i reference an interceptor like "routeContextRef" tag or
"restContextRef" tag?







--
View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Interceptor into external file

Posted by "fabrizio.spataro" <fa...@bizmate.it>.
Ok thanks, my (temporary?) implementation is:

FILE 1:
<routeContext id="interceptorRouteContext">
<route>
        <from uri="direct://interceptorImpl"/>
                             ........... MY CODE ...... 
                             ........... MY CODE ...... 
                             ........... MY CODE ...... 
                             ........... MY CODE ...... 
</route>

</routeContext>

MAIN FILE:

<camelContext xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="deadLetterErrorHandler">

		*<routeContextRef ref="interceptorRouteContext"/>*
                             ........... ANOTHER CODE ...... 
                             ........... ANOTHER CODE ...... 

                <interceptFrom uri="direct://ABC*">
                            <to uri="direct://interceptorImpl" />
                </interceptFrom>

                             ........... ANOTHER CODE ...... 
                             ........... ANOTHER CODE ...... 
                             ........... ANOTHER CODE ...... 

</camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771410.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Interceptor into external file

Posted by Raul Kripalani <ra...@evosent.com>.
If you are using OSGi you can leverage OSGi Service Listeners to
programmatically add the interceptors whenever a new context appears in the
environment.

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Thu, Sep 10, 2015 at 11:57 AM, fabrizio.spataro <
fabrizio.spataro@bizmate.it> wrote:

> Hello,
>
> i would use same interceptor (XML Spring implementation) into my different
> projects.
>
> Can i reference an interceptor like "routeContextRef" tag or
> "restContextRef" tag?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Interceptor into external file

Posted by Henryk Konsek <he...@gmail.com>.
I don't think it is possible in Spring XML DSL. However it is definitely
possible with Java DSL. Maybe you can switch to Java? Java DSL is really
flexible :) .

Cheers!

czw., 10.09.2015 o 14:28 użytkownik fabrizio.spataro <
fabrizio.spataro@bizmate.it> napisał:

> Camel interceptor:
>
> <camelContext xmlns="http://camel.apache.org/schema/spring"
> errorHandlerRef="deadLetterErrorHandler">
>                              ........... ANOTHER CODE ......
>                              ........... ANOTHER CODE ......
>                              ........... ANOTHER CODE ......
>
>                 <interceptFrom uri="direct://ABC*">
>                              ........... MY CODE ......
>                              ........... MY CODE ......
>                              ........... MY CODE ......
>                              ........... MY CODE ......
>                 </interceptFrom>
>
>                              ........... ANOTHER CODE ......
>                              ........... ANOTHER CODE ......
>                              ........... ANOTHER CODE ......
>
> </camelContext>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771403.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
-- 
Henryk Konsek
http://about.me/hekonsek

Re: Interceptor into external file

Posted by "fabrizio.spataro" <fa...@bizmate.it>.
Camel interceptor:

<camelContext xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="deadLetterErrorHandler">
                             ........... ANOTHER CODE ......
                             ........... ANOTHER CODE ......
                             ........... ANOTHER CODE ......

		<interceptFrom uri="direct://ABC*">
                             ........... MY CODE ......
                             ........... MY CODE ......
                             ........... MY CODE ......
                             ........... MY CODE ......
                </interceptFrom>

                             ........... ANOTHER CODE ......
                             ........... ANOTHER CODE ......
                             ........... ANOTHER CODE ......

</camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771403.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Interceptor into external file

Posted by Henryk Konsek <he...@gmail.com>.
Hi,

What kind of interceptor do you have in mind? Spring AOP one or Camel one?

Cheers!

czw., 10.09.2015 o 12:57 użytkownik fabrizio.spataro <
fabrizio.spataro@bizmate.it> napisał:

> Hello,
>
> i would use same interceptor (XML Spring implementation) into my different
> projects.
>
> Can i reference an interceptor like "routeContextRef" tag or
> "restContextRef" tag?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
-- 
Henryk Konsek
http://about.me/hekonsek