interceptSendToEndpoint

2014-07-01 Thread Preethi
Hi,

We have a RouteBuilder which does multiple interceptSendToEndpoint.
Something like this

@Override
public final void configure() throws Exception {

interceptSendToEndpoint("http4://test1.com/123456")
.process(new SecurityProcessor1());


    interceptSendToEndpoint("http4://test2.com/123456")
.process(new SecurityProcessor2());
}

It looks like the first intercept never works. If the url
http4://test1.com/123456 is invoked, the request would still go to
SecurityProcessor2 instead of SecurityProcessor1. Is this a known issue with
Camel?

We are using camel-spring-2.9.2

Thanks,
Preethi




--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-tp5753172.html
Sent from the Camel - Users mailing list archive at Nabble.com.


interceptSendToEndpoint

2016-05-10 Thread Bassett, Derek
Hi,

   From the description on http://camel.apache.org/intercept.html page it says:

"You can think of it as a AOP before that is applied at each DSL keyword you 
have defined in your route"


Can I use interceptSendToEndpoint if I want to do both a Before and After or do 
I have to use something else?  Basically I need to generate a WireTap for 
Auditing purposes ever time I make a http request out.  I understand the 
performance impacts but the business thinks its more important then actually 
being performant.  I wanted to see if there was a way I could do that with 
interceptSendToEndpoint, maybe using a custom Processors or something akin to a 
Before/After Advice.


Derek


Re: interceptSendToEndpoint

2014-07-02 Thread Claus Ibsen
Hi

Try with a newer Camel release.



On Tue, Jul 1, 2014 at 10:47 PM, Preethi  wrote:
> Hi,
>
> We have a RouteBuilder which does multiple interceptSendToEndpoint.
> Something like this
>
> @Override
> public final void configure() throws Exception {
>
> interceptSendToEndpoint("http4://test1.com/123456")
> .process(new SecurityProcessor1());
>
>
> interceptSendToEndpoint("http4://test2.com/123456")
> .process(new SecurityProcessor2());
> }
>
> It looks like the first intercept never works. If the url
> http4://test1.com/123456 is invoked, the request would still go to
> SecurityProcessor2 instead of SecurityProcessor1. Is this a known issue with
> Camel?
>
> We are using camel-spring-2.9.2
>
> Thanks,
> Preethi
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-tp5753172.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: interceptSendToEndpoint

2016-05-12 Thread James Green
You could do it that way and add a second interceptSendToEndpoint
intercepting the next hop I guess.

You may wish to consider what you are trying to achieve - if you do not
require the full payload to be audited it may be that using an HTTP proxy
satisfies your requirements and requires very little code to be maintained.

On 10 May 2016 at 20:49, Bassett, Derek 
wrote:

> Hi,
>
>From the description on http://camel.apache.org/intercept.html page it
> says:
>
> "You can think of it as a AOP before that is applied at each DSL keyword
> you have defined in your route"
>
>
> Can I use interceptSendToEndpoint if I want to do both a Before and After
> or do I have to use something else?  Basically I need to generate a WireTap
> for Auditing purposes ever time I make a http request out.  I understand
> the performance impacts but the business thinks its more important then
> actually being performant.  I wanted to see if there was a way I could do
> that with interceptSendToEndpoint, maybe using a custom Processors or
> something akin to a Before/After Advice.
>
>
> Derek
>


Issue with interceptSendToEndpoint

2009-10-12 Thread Martin Krasser

When I send a message to "direct:test1" in the following route builder, the
"hello" is written three-times to the console instead of only once, as
expected.

interceptSendToEndpoint("direct:intercept")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
System.out.println("hello");
}
});

from("direct:test1").to("direct:intercept");
from("direct:test2").to("direct:intercept");
from("direct:test3").to("direct:intercept");

The problem is that the "direct:intercept" endpoint is proxied/decorated
several times with an InterceptSendToEndpoint object, depending on the
number of to("direct:intercept") in the route builder.

One possible bugfix for this problem is to decorate the original endpoint
only if it's not already decorated (special handling in
InterceptSendToEndpoint class), but I'm not sure if this is the best
solution. If this sounds reasonable I can provide a patch.

Cheers,
Martin
-- 
View this message in context: 
http://www.nabble.com/Issue-with-interceptSendToEndpoint-tp25859201p25859201.html
Sent from the Camel - Users mailing list archive at Nabble.com.



InterceptSendToEndpoint - Http Component

2010-12-07 Thread Karthz

Hi,

I'm using Camel 2.5. And, this is an outline of what I'm trying to do,





   
java.lang.IllegalArgumentException













Looks like there's an issue while intercepting messages sent to a Http
Component. It gets intercepted correctly, and "Message Failure" gets printed
in the logs correctly too.  However, the message still gets sent to the Http
component anyway. [Note: the  "Message Success", however, doesn't get
printed in the logs.]

This behavior remains even if I use
   
AND/OR the actual http url, instead of the placeholder
   http://localhost:8080/test"; />

But if I intercept something else, and not the http component, then it works
fine. In the above route, this change
   
does exactly what I want it to do. It intercepts before the method, and the
method never gets executed in case of an exception.


So, what's the correct way to intercept something that's being sent to a
Http Component?

Thanks.


-
- Karthz
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3296620.html
Sent from the Camel - Users mailing list archive at Nabble.com.


java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-11 Thread Marco Crivellaro
in some circumstances interceptSendToEndpoint in conjunction with
recipientList and parallel processing is running in exception. this seems to
be the case when and http endpoint is sent in the recipient list after
having processed and ftp in the previous exchange

attached test case shows the expection
(java.util.concurrent.RejectedExecutionException)
http://camel.465427.n5.nabble.com/file/n3425179/FirstTest.java
FirstTest.java 

as a side note: if a separated interceptSendToEndpoint is specified for http
the route does not run in exception.

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3425179.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Issue with interceptSendToEndpoint

2009-10-12 Thread Claus Ibsen
On Mon, Oct 12, 2009 at 6:47 PM, Martin Krasser  wrote:
>
> When I send a message to "direct:test1" in the following route builder, the
> "hello" is written three-times to the console instead of only once, as
> expected.
>
> interceptSendToEndpoint("direct:intercept")
> .process(new Processor() {
>    public void process(Exchange exchange) throws Exception {
>        System.out.println("hello");
>    }
> });
>
> from("direct:test1").to("direct:intercept");
> from("direct:test2").to("direct:intercept");
> from("direct:test3").to("direct:intercept");
>
> The problem is that the "direct:intercept" endpoint is proxied/decorated
> several times with an InterceptSendToEndpoint object, depending on the
> number of to("direct:intercept") in the route builder.
>
> One possible bugfix for this problem is to decorate the original endpoint
> only if it's not already decorated (special handling in
> InterceptSendToEndpoint class), but I'm not sure if this is the best
> solution. If this sounds reasonable I can provide a patch.
>

Yeah it looks as it should only do it once per given endpoint.
Please create a ticket and provide a patch.


> Cheers,
> Martin
> --
> View this message in context: 
> http://www.nabble.com/Issue-with-interceptSendToEndpoint-tp25859201p25859201.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: InterceptSendToEndpoint - Http Component

2010-12-07 Thread Claus Ibsen
Hi

There is an attribute on the 
skipSendToOriginalEndpoint which you should set to true if you dont
want to send the message that was intercepted.

BTW: You IDE may assist you and show code completion etc. when editing
the XML files as its a good idea to see which attributes and whatnot
the XSD schema provides out of the box.


On Tue, Dec 7, 2010 at 11:19 PM, Karthz  wrote:
>
> Hi,
>
> I'm using Camel 2.5. And, this is an outline of what I'm trying to do,
>
>         inheritErrorHandler="true">
>            
>                
>                
>
> java.lang.IllegalArgumentException
>                    
>                    
>                
>            
>        
>
>        
>            
>            
>            
>            
>        
>
> Looks like there's an issue while intercepting messages sent to a Http
> Component. It gets intercepted correctly, and "Message Failure" gets printed
> in the logs correctly too.  However, the message still gets sent to the Http
> component anyway. [Note: the  "Message Success", however, doesn't get
> printed in the logs.]
>
> This behavior remains even if I use
>                inheritErrorHandler="true">
> AND/OR the actual http url, instead of the placeholder
>               http://localhost:8080/test"; />
>
> But if I intercept something else, and not the http component, then it works
> fine. In the above route, this change
>                uri="bean:xyz?method=doNothing" inheritErrorHandler="true">
> does exactly what I want it to do. It intercepts before the method, and the
> method never gets executed in case of an exception.
>
>
> So, what's the correct way to intercept something that's being sent to a
> Http Component?
>
> Thanks.
>
>
> -
> - Karthz
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3296620.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: InterceptSendToEndpoint - Http Component

2010-12-07 Thread Karthz

Thanks, Claus.

But, I want the original route skipped only when there's an exception.
Otherwise, it should send the message as normal. Should I still set
skipSendToOriginalEndpoint?

Thanks.

-
- Karthz
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3296960.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: InterceptSendToEndpoint - Http Component

2010-12-07 Thread Claus Ibsen
Hi

I had a look and there was an issue in Camel when using sto() which
the interceptSendToEndpoint didn't check.
I will get this fixed in the source code.

On Wed, Dec 8, 2010 at 7:10 AM, Karthz  wrote:
>
> Thanks, Claus.
>
> But, I want the original route skipped only when there's an exception.
> Otherwise, it should send the message as normal. Should I still set
> skipSendToOriginalEndpoint?
>
> Thanks.
>
> -
> - Karthz
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3296960.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: InterceptSendToEndpoint - Http Component

2010-12-08 Thread Karthz

Great, thank you.

Just curious - in which class is this fix needed?

-
- Karthz
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3297052.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: InterceptSendToEndpoint - Http Component

2010-12-08 Thread Claus Ibsen
On Wed, Dec 8, 2010 at 9:14 AM, Karthz  wrote:
>
> Great, thank you.
>
> Just curious - in which class is this fix needed?
>

The commit log is here
http://svn.apache.org/viewvc?rev=1043330&view=rev




> -
> - Karthz
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p3297052.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


interceptSendToEndpoint with dynamic endpoint

2010-12-11 Thread John

Hi,

I am using camel 2.2, though I did give this a shot with 2.5

I have a route that has an http endpoint that is configured at startup. In
my route builder I have something like:

String wsUrl = "http://host/ws";;

from("activemq:somequeue")
.bean("someBean")
.to(wsUrl);

While trying to create a unit test for this route, I am adding an
interceptSendToEndpoint to direct any requests to the wsUrl endpoint to a
mock endpoint.

I am unable to get the interceptor to work as long as I have a variable in
the original route endpoint. If I replace .to(wsUrl) with
.to("http://host/ws";) everything works fine in my test. The documentation
mentions that interceptSendToEndpoint should be fine with a dynamic URI.

Is there a way to use the interceptor in my test without a hard coded string
in the route endpoint?

Thanks,

-john

-- 
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3301978.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: InterceptSendToEndpoint - Http Component

2013-04-16 Thread dss.light
Hi, tried to use this feature for testing - excellently like advised - it
still did not skip intercepted endpoint.

Camel 2.10.4

What I am doing wrong? The first endpoint changed and worked;
In the log I see trying to post message to localhost.
And test fell down with exception.
I simply want to replace last endpoint to the other one.

code 

context.getRouteDefinitions().get(0).adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {   
replaceFromWith("direct:start");
    interceptSendToEndpoint(ReceiverBridge.TO_ENDPOINT)
.skipSendToOriginalEndpoint()
.to("mock:result");
}
});



--
View this message in context: 
http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p5730970.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-11 Thread Ashwin Karpe
Hi,

Camel uses an ExecutorService with a set of threads that are used as thread
pool to process incoming requests. In addition there is a backing
blockingQueue of a fixed capacity associated with the pools for requests
that cannot be immediately picked up for processing.

When threads are fully utilized and the work queue is full then this
particular exception is thrown.

Are you running this route under a heavy load? In any case, you can further
configure the camel context thread pool by injecting your own thread pool.
Please check link below.

http://camel.apache.org/threading-model.html
http://camel.apache.org/threading-model.html 

This should help alleviate your issue.

Cheers,

Ashwin...

-
-
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
-
--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3426033.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-14 Thread Marco Crivellaro
That is not an heavy load sample, it runs in exception after the 2nd time it
runs the for cycle...

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3556257.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-15 Thread Marco Crivellaro
why isn't the route running in exception if instead of using an intercept
send to endpoint for all protocols I define 2 different inteceptors, 1 for
ftp and 1 for http?

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3709344.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-15 Thread Marco Crivellaro
to make it run in exception you don't even need to run a cycle of with many
messages sent, you just need to define an the interceptor for ftp and http:

interceptSendToEndpoint("(ftp|sftp|ftps|http):.*").process(
  new Processor() {
public void process(Exchange exchange) throws Exception {

}
  }
);


and send following messages (recipientList)


template.sendBodyAndHeader("direct:start", String.format("Hello Word %1s",
0) , FirstTest.recipientListHeaderName, ftpEp + ","+ httpEp );
template.sendBodyAndHeader("direct:start", String.format("Hello Word %1s",
0) , FirstTest.recipientListHeaderName, httpEp);

(where ftpEp and httpEp are valid endpoints)



--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3709879.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-15 Thread Marco Crivellaro
The following sample: 
http://camel.465427.n5.nabble.com/file/n3710309/FirstTest.java
FirstTest.java 

shows the same issue with only 2 messages sent to 2 distinct endpoints.
if instead of using a single interceptor "(ftp|sftp|ftps|http):.*"

2 distinct interceptors are defined:
"(ftp|sftp|ftps):.*" and "(http):.*" the exception is not thrown.

It is not a problem for me to use this workaround although I would like to
know the reason why this is happening and if I should expect the same issues
with other types of endpoints.

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3710309.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-18 Thread Claus Ibsen
On Tue, Mar 15, 2011 at 6:00 PM, Marco Crivellaro
 wrote:
> The following sample:
> http://camel.465427.n5.nabble.com/file/n3710309/FirstTest.java
> FirstTest.java
>
> shows the same issue with only 2 messages sent to 2 distinct endpoints.
> if instead of using a single interceptor "(ftp|sftp|ftps|http):.*"
>
> 2 distinct interceptors are defined:
> "(ftp|sftp|ftps):.*" and "(http):.*" the exception is not thrown.
>
> It is not a problem for me to use this workaround although I would like to
> know the reason why this is happening and if I should expect the same issues
> with other types of endpoints.

Can you create a small unit test which reproduces the issue? And
create a JIRA ticket and attach the unit test.
I am traveling at the moment but will look into when I get back.

Bugs have high priority so we usually fix them in the next release.


>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3710309.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-21 Thread Marco Crivellaro
I've created a ticket and attached a test to it
https://issues.apache.org/jira/browse/CAMEL-3795

please let me know if you need further details.

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p4235950.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

2011-03-28 Thread Marco Crivellaro
Hi Claus, I've seen you closed the ticket and added a unit test. The unit
test uses mock up endpoint which does not show the wrong behaviour.
The test I've attached to the ticket does not make use of custom thread pool
as you've reported:

from("direct:start").recipientList(header(InterceptSendToEndpointException.recipientListHeaderName).tokenize(",")).to("mock:end");

--
View this message in context: 
http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p4267160.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: InterceptSendToEndpoint - Http Component

2013-04-17 Thread Claus Ibsen
Hi

Possible use wildcards in the interceptSendToEndpoint to match the
http url. As if you have parameters then that's tricky.
See details about wildcards at: http://camel.apache.org/intercept

On Tue, Apr 16, 2013 at 3:24 PM, dss.light  wrote:
> Hi, tried to use this feature for testing - excellently like advised - it
> still did not skip intercepted endpoint.
>
> Camel 2.10.4
>
> What I am doing wrong? The first endpoint changed and worked;
> In the log I see trying to post message to localhost.
> And test fell down with exception.
> I simply want to replace last endpoint to the other one.
>
> code
>
> context.getRouteDefinitions().get(0).adviceWith(context, new
> AdviceWithRouteBuilder() {
> @Override
> public void configure() throws Exception {
> replaceFromWith("direct:start");
> interceptSendToEndpoint(ReceiverBridge.TO_ENDPOINT)
> .skipSendToOriginalEndpoint()
> .to("mock:result");
> }
>     });
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/InterceptSendToEndpoint-Http-Component-tp3296620p5730970.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


1.6 equivalent of interceptFrom/interceptSendToEndpoint

2009-10-07 Thread efender

I think this would be the correct syntax to intercept all exchanges on
ContentManagerClearCacheTopic, converting beans to JSON on the way in, and
JSON back to beans on the way out.













Can anyone convert that to 1.6 syntax for me or point me in the right
direction?  The old docs seem to disappear when new versions are released. 
I don't have the time to do a 2.0 upgrade right now.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/1.6-equivalent-of-interceptFrom-interceptSendToEndpoint-tp25791665p25791665.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread Claus Ibsen
On Sun, Dec 12, 2010 at 7:07 AM, John  wrote:
>
> Hi,
>
> I am using camel 2.2, though I did give this a shot with 2.5
>
> I have a route that has an http endpoint that is configured at startup. In
> my route builder I have something like:
>
> String wsUrl = "http://host/ws";;
>
> from("activemq:somequeue")
>    .bean("someBean")
>    .to(wsUrl);
>
> While trying to create a unit test for this route, I am adding an
> interceptSendToEndpoint to direct any requests to the wsUrl endpoint to a
> mock endpoint.
>
> I am unable to get the interceptor to work as long as I have a variable in
> the original route endpoint. If I replace .to(wsUrl) with
> .to("http://host/ws";) everything works fine in my test. The documentation
> mentions that interceptSendToEndpoint should be fine with a dynamic URI.
>

Read the documentation, you can use wildcards in the interceptor, for
example a * or an reg exp expressions
http://camel.apache.org/intercept.html

And in later Camel releases you can use property placeholders in your
routes to avoid hardcoding
http://camel.apache.org/properties.html

> Is there a way to use the interceptor in my test without a hard coded string
> in the route endpoint?
>
> Thanks,
>
> -john
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3301978.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread John

Hi Claus,

I'm already using a wild card to try and perform the match. The issue
appears to be with using the adviceWith method to setup the
interceptSendToEndpoint call in my unit test.

This works perfectly when the endpoint in the route I'm testing is not
configured via spring properties.

Here is what I'm doing in the unit test to setup the interceptor:

RouteDefinition myRoute = 
context.getRouteDefinition("myRoute");

myRoute.adviceWith(new RouteBuilder()
{   

@Override
public void configure() throws Exception
    {
     interceptSendToEndpoint("http*")
.skipSendToOriginalEndpoint()
.to(mockWsEndpoint);
}
});

Thanks,

-john

-- 
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3302930.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread Claus Ibsen
On Mon, Dec 13, 2010 at 11:44 AM, John  wrote:
>
> Hi Claus,
>
> I'm already using a wild card to try and perform the match. The issue
> appears to be with using the adviceWith method to setup the
> interceptSendToEndpoint call in my unit test.
>
> This works perfectly when the endpoint in the route I'm testing is not
> configured via spring properties.
>

What do you mean with spring properties? Can you post your example in full?


> Here is what I'm doing in the unit test to setup the interceptor:
>
>        RouteDefinition myRoute =
>            context.getRouteDefinition("myRoute");
>
>        myRoute.adviceWith(new RouteBuilder()
>        {
>
>           �...@override
>            public void configure() throws Exception
>            {
>                 interceptSendToEndpoint("http*")
>                    .skipSendToOriginalEndpoint()
>                    .to(mockWsEndpoint);
>            }
>        });
>
> Thanks,
>
> -john
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3302930.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread John

My application has a route defined like:

public MyRoute extends RouteBuilder implements InitializingBean,
DisposableBean
{
private String host;
private String user;
private String pw;

private String wsUrl;

afterPropertiesSet()
{
wsUrl = "http://"; + host + "/some_ws" + "?username=" + user +
"&password=" + pw;
}

public void configure()
{
from("activemq:somequeue")
.bean("someBean")
.to(wsUrl);
}
}

In my spring xml I define:

http://camel.apache.org/schema/spring"; trace="true">









So I'm trying to create a unit test with a mock endpoint for the web service
call in the route. To do that I'm attempting to add the interceptor via
adviceWith that I showed above. I can't get the interceptor to actually work
though when my original route uses the wsUrl variable. If I replace wsUrl
with the String "http://some_stuff"; the interceptor works fine.

Thanks,

-john
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3303122.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread Claus Ibsen
Add a system.out.println(wsUrl) so you can see that the url has been
resolved and spring have invoked the afterPropertiesSet. BEFORE the
adviceWith is being invoked in your test.



On Mon, Dec 13, 2010 at 2:55 PM, John  wrote:
>
> My application has a route defined like:
>
> public MyRoute extends RouteBuilder implements InitializingBean,
> DisposableBean
> {
>    private String host;
>    private String user;
>    private String pw;
>
>    private String wsUrl;
>
>    afterPropertiesSet()
>    {
>        wsUrl = "http://"; + host + "/some_ws" + "?username=" + user +
> "&password=" + pw;
>    }
>
>    public void configure()
>    {

Add System.out here!!!


>        from("activemq:somequeue")
>            .bean("someBean")
>            .to(wsUrl);
>    }
> }
>
> In my spring xml I define:
>
> http://camel.apache.org/schema/spring"; trace="true">
>    
> 
>
> 
>    
>    
>    
> 
>
> So I'm trying to create a unit test with a mock endpoint for the web service
> call in the route. To do that I'm attempting to add the interceptor via
> adviceWith that I showed above. I can't get the interceptor to actually work
> though when my original route uses the wsUrl variable. If I replace wsUrl
> with the String "http://some_stuff"; the interceptor works fine.
>
> Thanks,
>
> -john
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3303122.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-13 Thread John

I added a System.out.println in the route class to show that when the route
is starting wsUrl is set properly. 

I also added a println to the test class right before I add the adviceWith.
The adviceWith call in the test class appears to occur after the route has
successfully loaded.

I was trying to see if I could determine from the RouteDefinition in the
test class what the endpoint in question looks like.
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3303142.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-14 Thread John

I've started testing with the camel 2.6 snapshot and believe I have found the
root of the issue.

The endpoint I am trying to test is an http endpoint. I included the user
name and password as query params in the URI.

Having a "&" in the URI prevents the InterceptSendToEndpoint from working
correctly. I recreated the issue with a static http endpoint like

.to("http:host/my_ws?arg1=ok&arg2=bad")

Out of curiosity I printed out the endpoints in my route after adding the
interceptor. On the URI without the "&", I only see one endpoint:

endPoint.uri = http://host/some_place/junk?arg1=ok
endPoint.class = class org.apache.camel.impl.InterceptSendToEndpoint

On the URI with the "&", I see two endpoints:

endPoint.uri = http://host/some_place/junk?arg2=bad&arg1=ok
endPoint.class = class org.apache.camel.impl.InterceptSendToEndpoint
endPoint.uri = http://host/some_place/junk?arg2=bad&arg1=ok
endPoint.class = class org.apache.camel.component.http.HttpEndpoint

-john

-- 
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3305364.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2010-12-15 Thread Claus Ibsen
Hi

I was able to reproduce the issue and I will fix this in the next release.
https://issues.apache.org/jira/browse/CAMEL-3430


On Tue, Dec 14, 2010 at 11:00 PM, John  wrote:
>
> I've started testing with the camel 2.6 snapshot and believe I have found the
> root of the issue.
>
> The endpoint I am trying to test is an http endpoint. I included the user
> name and password as query params in the URI.
>
> Having a "&" in the URI prevents the InterceptSendToEndpoint from working
> correctly. I recreated the issue with a static http endpoint like
>
> .to("http:host/my_ws?arg1=ok&arg2=bad")
>
> Out of curiosity I printed out the endpoints in my route after adding the
> interceptor. On the URI without the "&", I only see one endpoint:
>
> endPoint.uri = http://host/some_place/junk?arg1=ok
> endPoint.class = class org.apache.camel.impl.InterceptSendToEndpoint
>
> On the URI with the "&", I see two endpoints:
>
> endPoint.uri = http://host/some_place/junk?arg2=bad&arg1=ok
> endPoint.class = class org.apache.camel.impl.InterceptSendToEndpoint
> endPoint.uri = http://host/some_place/junk?arg2=bad&arg1=ok
> endPoint.class = class org.apache.camel.component.http.HttpEndpoint
>
> -john
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p3305364.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


interceptFrom and interceptSendToEndpoint not working

2017-07-14 Thread laiyhman
Hi,

I was trying to intercept from/to specific rabbitmq route something like the
following,
interceptFrom(rabbitmq:localhost/someExchangeName?queue="somerRabbitMqQueueName").to("log:hello");

and i'm not getting anything there.

I've tested intercept().to("log:hello") and i can confirm it's working, can
anyone let me know if there's something else that i need to configure to
make the intercept from/to works?

We're using Java DSL and Google Guice for dependency injection. Some of the
project setup as follows,

camel version: 2.18.3 (tried also 2.19.1)
camel-guice: 2.18.3
guice-multibindings: 4.1.0
camel-rabbitmq: 2.18.3
maven-compiler-plugin: 1.7



--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2013-09-28 Thread Jeff Eltgroth
Hi,

I am using camel-core 2.10.0.fuse-71-047 and I am getting similar problems
using interceptSendToEndpoint.  My uri has a pound sign (#) which is getting
encoded to %23.  This is the kind of uri I am using: 
"aws-sqs://myQueue?amazonSQSClient=#myClient" where myClient is in the
registry.

Jeff



--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p5740263.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptSendToEndpoint with dynamic endpoint

2013-09-28 Thread Claus Ibsen
Then just use * in the intercept

interceptSendToEndpoint("aws-sqs://myQueue*") ...

On Thu, Sep 26, 2013 at 5:41 PM, Jeff Eltgroth  wrote:
> Hi,
>
> I am using camel-core 2.10.0.fuse-71-047 and I am getting similar problems
> using interceptSendToEndpoint.  My uri has a pound sign (#) which is getting
> encoded to %23.  This is the kind of uri I am using:
> "aws-sqs://myQueue?amazonSQSClient=#myClient" where myClient is in the
> registry.
>
> Jeff
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptSendToEndpoint-with-dynamic-endpoint-tp3301978p5740263.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: 1.6 equivalent of interceptFrom/interceptSendToEndpoint

2009-10-07 Thread Claus Ibsen
Hi

1.6 does not have these features.

On Wed, Oct 7, 2009 at 8:36 PM, efender  wrote:
>
> I think this would be the correct syntax to intercept all exchanges on
> ContentManagerClearCacheTopic, converting beans to JSON on the way in, and
> JSON back to beans on the way out.
>
> 
>    
> 
>
> 
>    
> 
>
> 
>    
> 
>
> Can anyone convert that to 1.6 syntax for me or point me in the right
> direction?  The old docs seem to disappear when new versions are released.
> I don't have the time to do a 2.0 upgrade right now.
>
> Thanks.
> --
> View this message in context: 
> http://www.nabble.com/1.6-equivalent-of-interceptFrom-interceptSendToEndpoint-tp25791665p25791665.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Yasser Zamani
Hi there,

Assume following XML DSL:


  
  

${headers.messageType} != null &&
${headers.serviceType} != null


  
  

  ${headers.messageType} == 'Property'
  

.
.
.

I found several issues listed below ordered by bug likelihood:

1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match as
I expect. I debugged and saw that Camel tries to match
"http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
"http://localhost:8080/camel/external_mock/*"; (because ext.url is set to
http://localhost:8080/camel/external_mock) and it doesn't match, Camel
is right but why it's removed "/Property${headers.serviceType}" from the
interceptedUri?! because it has dynamics? it doesn't match because it's
removed this portion. I expect Camel to match
"http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
not "http://localhost:8080?bridgeEndpoint=true";.

2. As you see I've defined it at route level but I see all of my other
"http:*" endpoints will be intercepted! Is this expected?!

3. As per Camel docs, when `when` condition evaluates to false then the
interception shouldn't being triggered, but I see yes, it doesn't go to
the "direct:req_out" but always go to the afterUri i.e.
"direct:after_dispatch" regardless of `when`! Is this expected?

Thanks in advance!

Regards.


Re: interceptFrom and interceptSendToEndpoint not working

2017-07-14 Thread Claus Ibsen
Hi

Its likely the endpoint uri matching that dont match exactly, use
wildcards with *, eg

interceptFrom("rabbitmq:*")


On Fri, Jul 14, 2017 at 10:15 AM, laiyhman  wrote:
> Hi,
>
> I was trying to intercept from/to specific rabbitmq route something like the
> following,
> interceptFrom(rabbitmq:localhost/someExchangeName?queue="somerRabbitMqQueueName").to("log:hello");
>
> and i'm not getting anything there.
>
> I've tested intercept().to("log:hello") and i can confirm it's working, can
> anyone let me know if there's something else that i need to configure to
> make the intercept from/to works?
>
> We're using Java DSL and Google Guice for dependency injection. Some of the
> project setup as follows,
>
> camel version: 2.18.3 (tried also 2.19.1)
> camel-guice: 2.18.3
> guice-multibindings: 4.1.0
> camel-rabbitmq: 2.18.3
> maven-compiler-plugin: 1.7
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: interceptFrom and interceptSendToEndpoint not working

2017-07-14 Thread laiyhman
Hi,

That wildcard works, however i would like to intercept specific uri such as
"rabbitmq:localhost/someExchangeName?queue="somerRabbitMqQueueName".
Is that format valid and correct?





--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012p5807014.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptFrom and interceptSendToEndpoint not working

2017-07-14 Thread Claus Ibsen
Make sure it can match the actual url, so make sure they are exact the
same if you are not using wildcard, you can just do

rabbitmq:localhost/xxx*

Or try with

rabbitmq:localhost/xxx?queue=foo*



On Fri, Jul 14, 2017 at 10:43 AM, laiyhman  wrote:
> Hi,
>
> That wildcard works, however i would like to intercept specific uri such as
> "rabbitmq:localhost/someExchangeName?queue="somerRabbitMqQueueName".
> Is that format valid and correct?
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012p5807014.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: interceptFrom and interceptSendToEndpoint not working

2017-07-16 Thread laiyhman
Hi,

The following works 
rabbitmq:localhost/xxx* 

but anything with the "queue" like below does not work,
rabbitmq:localhost/xxx?queue=*
rabbitmq:localhost/xxx?queue=yyy* 



--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012p5807171.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: interceptFrom and interceptSendToEndpoint not working

2017-07-17 Thread Claus Ibsen
Mind that the query parameters is sorted a..z by Camel, so if you have
more than one parameter then set your wildcard accordingly, or use a
regular expression syntax instead, which is also possible.
http://camel.apache.org/intercept



On Mon, Jul 17, 2017 at 4:47 AM, laiyhman  wrote:
> Hi,
>
> The following works
> rabbitmq:localhost/xxx*
>
> but anything with the "queue" like below does not work,
> rabbitmq:localhost/xxx?queue=*
> rabbitmq:localhost/xxx?queue=yyy*
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/interceptFrom-and-interceptSendToEndpoint-not-working-tp5807012p5807171.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Claus Ibsen
Hi

What Camel version do you use?

Also mind about matching by exact uri, then the order of the query
parameters also matter. So if that is not really what you need, then
use a * to match with wildcard

On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  wrote:
>
> Hi there,
>
> Assume following XML DSL:
>
> 
>   
>afterUri="direct:after_dispatch">
> 
> ${headers.messageType} != null &&
> ${headers.serviceType} != null
> 
> 
>   
>   
> 
>   ${headers.messageType} == 'Property'
>uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> 
> .
> .
> .
>
> I found several issues listed below ordered by bug likelihood:
>
> 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match as
> I expect. I debugged and saw that Camel tries to match
> "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> "http://localhost:8080/camel/external_mock/*"; (because ext.url is set to
> http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> is right but why it's removed "/Property${headers.serviceType}" from the
> interceptedUri?! because it has dynamics? it doesn't match because it's
> removed this portion. I expect Camel to match
> "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> not "http://localhost:8080?bridgeEndpoint=true";.
>
> 2. As you see I've defined it at route level but I see all of my other
> "http:*" endpoints will be intercepted! Is this expected?!
>
> 3. As per Camel docs, when `when` condition evaluates to false then the
> interception shouldn't being triggered, but I see yes, it doesn't go to
> the "direct:req_out" but always go to the afterUri i.e.
> "direct:after_dispatch" regardless of `when`! Is this expected?
>
> Thanks in advance!
>
> Regards.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Yasser Zamani
Thanks for the quick reply!

(please see in-line)

On 2021/05/18 15:59:34, Claus Ibsen  wrote: 
> Hi
> 
> What Camel version do you use?

I use Camel 3.7.3.

> 
> Also mind about matching by exact uri, then the order of the query
> parameters also matter. So if that is not really what you need, then

Matching by exact uri isn't possible in my case. But to test I'd also tested an 
absolute uri 
"http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true"; 
which didn't work. The problem isn't order of query parameters. As I said the 
problem is I don't know why but my break point showed me that Camel is trying 
to test 
"http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
 which doesn't match because the "/camel/external_mock/" is missing in the 
intercepted uri, provided it is present in the exact uri or wildcard uri 
expression.

My best guess is that's because of my dynamic .toD where I have 
${headers.serviceType} included in the http url. For example I guess following 
simplified XML DSL won't work as well:

http://localhost:8080/*";>
  


  
  http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>

BTW any idea about issues #2 and #3?

Regards.

> use a * to match with wildcard
> 
> On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  wrote:
> >
> > Hi there,
> >
> > Assume following XML DSL:
> >
> > 
> >   
> >> afterUri="direct:after_dispatch">
> > 
> > ${headers.messageType} != null &&
> > ${headers.serviceType} != null
> > 
> > 
> >   
> >   
> > 
> >   ${headers.messageType} == 'Property'
> >> uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > 
> > .
> > .
> > .
> >
> > I found several issues listed below ordered by bug likelihood:
> >
> > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match as
> > I expect. I debugged and saw that Camel tries to match
> > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> > "http://localhost:8080/camel/external_mock/*"; (because ext.url is set to
> > http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> > is right but why it's removed "/Property${headers.serviceType}" from the
> > interceptedUri?! because it has dynamics? it doesn't match because it's
> > removed this portion. I expect Camel to match
> > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> > not "http://localhost:8080?bridgeEndpoint=true";.
> >
> > 2. As you see I've defined it at route level but I see all of my other
> > "http:*" endpoints will be intercepted! Is this expected?!
> >
> > 3. As per Camel docs, when `when` condition evaluates to false then the
> > interception shouldn't being triggered, but I see yes, it doesn't go to
> > the "direct:req_out" but always go to the afterUri i.e.
> > "direct:after_dispatch" regardless of `when`! Is this expected?
> >
> > Thanks in advance!
> >
> > Regards.
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
> 


Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Claus Ibsen
Hi

That is because you use toD with http that camel optimizes under the
hood to use a base endpoint and using headers with the dynamic
context-path part.
The interceptor can then not match that pattern.

You can turn this off in toD
Or you can check the header (CamelHttpPath is the name I think) in
 to see if it matches that part of your context-path.

On Tue, May 18, 2021 at 7:58 PM Yasser Zamani  wrote:
>
> Thanks for the quick reply!
>
> (please see in-line)
>
> On 2021/05/18 15:59:34, Claus Ibsen  wrote:
> > Hi
> >
> > What Camel version do you use?
>
> I use Camel 3.7.3.
>
> >
> > Also mind about matching by exact uri, then the order of the query
> > parameters also matter. So if that is not really what you need, then
>
> Matching by exact uri isn't possible in my case. But to test I'd also tested 
> an absolute uri 
> "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true"; 
> which didn't work. The problem isn't order of query parameters. As I said the 
> problem is I don't know why but my break point showed me that Camel is trying 
> to test 
> "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
>  which doesn't match because the "/camel/external_mock/" is missing in the 
> intercepted uri, provided it is present in the exact uri or wildcard uri 
> expression.
>
> My best guess is that's because of my dynamic .toD where I have 
> ${headers.serviceType} included in the http url. For example I guess 
> following simplified XML DSL won't work as well:
>
> http://localhost:8080/*";>
>   
> 
> 
>   
>uri="http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>
>
> BTW any idea about issues #2 and #3?
>
> Regards.
>
> > use a * to match with wildcard
> >
> > On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  
> > wrote:
> > >
> > > Hi there,
> > >
> > > Assume following XML DSL:
> > >
> > > 
> > >   
> > >> > afterUri="direct:after_dispatch">
> > > 
> > > ${headers.messageType} != null &&
> > > ${headers.serviceType} != null
> > > 
> > > 
> > >   
> > >   
> > > 
> > >   ${headers.messageType} == 'Property'
> > >> > uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > > 
> > > .
> > > .
> > > .
> > >
> > > I found several issues listed below ordered by bug likelihood:
> > >
> > > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match as
> > > I expect. I debugged and saw that Camel tries to match
> > > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> > > "http://localhost:8080/camel/external_mock/*"; (because ext.url is set to
> > > http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> > > is right but why it's removed "/Property${headers.serviceType}" from the
> > > interceptedUri?! because it has dynamics? it doesn't match because it's
> > > removed this portion. I expect Camel to match
> > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> > > not "http://localhost:8080?bridgeEndpoint=true";.
> > >
> > > 2. As you see I've defined it at route level but I see all of my other
> > > "http:*" endpoints will be intercepted! Is this expected?!
> > >
> > > 3. As per Camel docs, when `when` condition evaluates to false then the
> > > interception shouldn't being triggered, but I see yes, it doesn't go to
> > > the "direct:req_out" but always go to the afterUri i.e.
> > > "direct:after_dispatch" regardless of `when`! Is this expected?
> > >
> > > Thanks in advance!
> > >
> > > Regards.
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


interceptSendToEndpoint broken when setting address of CxfEndpoint

2023-06-13 Thread Speckels, Bert
Hello everyone.

We have currently a problem with intercepting our cxf endpoint (sending):

interceptSendToEndpoint("cxf*")
        .to("bean:mockSoapSendingInterceptor?method=mock");

---

But I found the reason why intercepting does not work. 
We use java code to configure our CxfEndpoint:

CxfEndpoint endpoint = (CxfEndpoint) 
camelContext.getEndpoint("cxf://OUR_ENDPOINT");
endpoint.setAddress("http://remotehost/ws/service";);
...

The problem is that setAddress(..) in CxfEndpoint not only set the target 
address but also replaces the endpoint uri. 
So the interceptor does not match because the endpoint uri doesn't start with 
"cxf" anymore but with "http".

Here is the code from CXF:

public void setAddress(String address) {
    super.setEndpointUri(UnsafeUriCharactersEncoder.encodeHttpURI(address));
    this.address = address;
}

Is this really a good idea to replace the endpoint uri starting with "cxf:" 
with the target url of the soap endpoint?
---

We had some good reasons to use "setAdress" instead or passing the endpoit uri 
directly like in the following example:

CxfEndpoint endpoint = (CxfEndpoint) 
camelContext.getEndpoint("cxf://http://remotehost/ws/service";);

I will try to figure out why this was not possible for us.
But in the meantime: Maybe you have some other hints for me?!

With kind regards
Bert Speckels

InterceptSendToEndpoint and access the intercepted endpoint details?

2023-09-06 Thread Mikael Koskinen
Hi,

If I'm intercepting (using InterceptSendToEndpoint) the exchange before it
is sent to an endpoint, can I somehow access the details of the endpoint
which I intercepted?

For example if I have Log-component in my route and I use
InterceptSendToEndpoint to intercept the request, can I somehow check the
details of the intercepted Log-component (like parameters etc.)?

Thank you in advance.

Best regards,
Mikael


How to use InterceptSendToEndpoint from Java DSL

2018-06-08 Thread Jackson, Douglas
Hi!
I need to replace my blueprint DSL with Java DSL. I want to intercept all 
attempts to send to certain queues, not just for one route, but for everything.
Here is the blueprint DSL:

http://camel.apache.org/schema/blueprint";>





When I put calls to the interceptSendToEndpoint() method in a RouteBuilder 
configure method, they did not work.


The java documentation on the InterceptSendToEndpoint is poor. I have also 
found no good examples.


Douglas Jackson



How to hande exceptions raised in "interceptSendToEndpoint"

2019-08-08 Thread chege
Hi,

I have a parent route builder that defines an interceptor and excpetion
handler as follows.

onException(Exception.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("Handling Error");
}
});

 interceptSendToEndpoint("velocity://*")
.setHeader("includeplaintext", () -> "true")
.setHeader("CamelVelocitySupplementalContext",
method("mailRouter", "x"));

Here is a simplified definition of method "x"

public Map x(@Header("test") String schema) {
throw new RuntimeException("error");
}


Then I have a route that will trigger above interceptor defined as
follows.

from("activemq://queue:inquiryresponse")
.routeId("Inquiry Response")
.log("Sending Inquiry Response ${body}")
.setHeader("subject", constant("Inquiry Response"))
.setHeader("to",
simple("${body['fname']}<${body['ccemail']}>"))
.to("velocity://templates/inquiry_response.html")
.to("bean:mailRouter?method=routeEmail")
.log("Sent Inquiry Response ${body}");

The exception handler above is not invoked. What I am missing?

Thanks,
Chege.





Re: Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Yasser Zamani



On 2021/05/18 18:03:47 Claus Ibsen wrote:
> Hi
> 
> That is because you use toD with http that camel optimizes under the
> hood to use a base endpoint and using headers with the dynamic
> context-path part.
> The interceptor can then not match that pattern.
> 
> You can turn this off in toD
> Or you can check the header (CamelHttpPath is the name I think) in
>  to see if it matches that part of your context-path.

Thanks for the clarification! This is the place where issue#3 emerges: afterUri 
will be triggered always regardless of the when evaluation result. Is this 
expected? Camel docs say it won't be triggered at all when condition is false.

The root cause of my findings was issue#2. I've defined interception at route 
level but it intercepts all http endpoints inside the camel context. Is this 
expected? If so then why am I allowed to define it in route scope?

Regards.

> 
> On Tue, May 18, 2021 at 7:58 PM Yasser Zamani  wrote:
> >
> > Thanks for the quick reply!
> >
> > (please see in-line)
> >
> > On 2021/05/18 15:59:34, Claus Ibsen  wrote:
> > > Hi
> > >
> > > What Camel version do you use?
> >
> > I use Camel 3.7.3.
> >
> > >
> > > Also mind about matching by exact uri, then the order of the query
> > > parameters also matter. So if that is not really what you need, then
> >
> > Matching by exact uri isn't possible in my case. But to test I'd also 
> > tested an absolute uri 
> > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true"; 
> > which didn't work. The problem isn't order of query parameters. As I said 
> > the problem is I don't know why but my break point showed me that Camel is 
> > trying to test 
> > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
> >  which doesn't match because the "/camel/external_mock/" is missing in the 
> > intercepted uri, provided it is present in the exact uri or wildcard uri 
> > expression.
> >
> > My best guess is that's because of my dynamic .toD where I have 
> > ${headers.serviceType} included in the http url. For example I guess 
> > following simplified XML DSL won't work as well:
> >
> > http://localhost:8080/*";>
> >   
> > 
> > 
> >   
> >> uri="http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>
> >
> > BTW any idea about issues #2 and #3?
> >
> > Regards.
> >
> > > use a * to match with wildcard
> > >
> > > On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  
> > > wrote:
> > > >
> > > > Hi there,
> > > >
> > > > Assume following XML DSL:
> > > >
> > > > 
> > > >   
> > > >> > > afterUri="direct:after_dispatch">
> > > > 
> > > > ${headers.messageType} != null &&
> > > > ${headers.serviceType} != null
> > > > 
> > > > 
> > > >   
> > > >   
> > > > 
> > > >   ${headers.messageType} == 'Property'
> > > >> > > uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > > > 
> > > > .
> > > > .
> > > > .
> > > >
> > > > I found several issues listed below ordered by bug likelihood:
> > > >
> > > > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match as
> > > > I expect. I debugged and saw that Camel tries to match
> > > > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> > > > "http://localhost:8080/camel/external_mock/*"; (because ext.url is set to
> > > > http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> > > > is right but why it's removed "/Property${headers.serviceType}" from the
> > > > interceptedUri?! because it has dynamics? it doesn't match because it's
> > > > removed this portion. I expect Camel to match
> > > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> > > > not "http://localhost:8080?bridgeEndpoint=true";.
> > > >
> > > > 2. As you see I've defined it at route level but I see all of my other
> > > > "http:*" endpoints will be intercepted! Is this expected?!
> > > >
> > > > 3. As per Camel docs, when `when` condition evaluates to false then the
> > > > interception shouldn't being triggered, but I see yes, it doesn't go to
> > > > the "direct:req_out" but always go to the afterUri i.e.
> > > > "direct:after_dispatch" regardless of `when`! Is this expected?
> > > >
> > > > Thanks in advance!
> > > >
> > > > Regards.
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
> 


Re: Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Claus Ibsen
Hi

The after is always executed, however you can argue that it should not
when you have a when filter.
https://issues.apache.org/jira/browse/CAMEL-16629

On Tue, May 18, 2021 at 10:04 PM Yasser Zamani  wrote:
>
>
>
> On 2021/05/18 18:03:47 Claus Ibsen wrote:
> > Hi
> >
> > That is because you use toD with http that camel optimizes under the
> > hood to use a base endpoint and using headers with the dynamic
> > context-path part.
> > The interceptor can then not match that pattern.
> >
> > You can turn this off in toD
> > Or you can check the header (CamelHttpPath is the name I think) in
> >  to see if it matches that part of your context-path.
>
> Thanks for the clarification! This is the place where issue#3 emerges: 
> afterUri will be triggered always regardless of the when evaluation result. 
> Is this expected? Camel docs say it won't be triggered at all when condition 
> is false.
>
> The root cause of my findings was issue#2. I've defined interception at route 
> level but it intercepts all http endpoints inside the camel context. Is this 
> expected? If so then why am I allowed to define it in route scope?
>
> Regards.
>
> >
> > On Tue, May 18, 2021 at 7:58 PM Yasser Zamani  
> > wrote:
> > >
> > > Thanks for the quick reply!
> > >
> > > (please see in-line)
> > >
> > > On 2021/05/18 15:59:34, Claus Ibsen  wrote:
> > > > Hi
> > > >
> > > > What Camel version do you use?
> > >
> > > I use Camel 3.7.3.
> > >
> > > >
> > > > Also mind about matching by exact uri, then the order of the query
> > > > parameters also matter. So if that is not really what you need, then
> > >
> > > Matching by exact uri isn't possible in my case. But to test I'd also 
> > > tested an absolute uri 
> > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";
> > >  which didn't work. The problem isn't order of query parameters. As I 
> > > said the problem is I don't know why but my break point showed me that 
> > > Camel is trying to test 
> > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
> > >  which doesn't match because the "/camel/external_mock/" is missing in 
> > > the intercepted uri, provided it is present in the exact uri or wildcard 
> > > uri expression.
> > >
> > > My best guess is that's because of my dynamic .toD where I have 
> > > ${headers.serviceType} included in the http url. For example I guess 
> > > following simplified XML DSL won't work as well:
> > >
> > > http://localhost:8080/*";>
> > >   
> > > 
> > > 
> > >   
> > >> > uri="http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>
> > >
> > > BTW any idea about issues #2 and #3?
> > >
> > > Regards.
> > >
> > > > use a * to match with wildcard
> > > >
> > > > On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  
> > > > wrote:
> > > > >
> > > > > Hi there,
> > > > >
> > > > > Assume following XML DSL:
> > > > >
> > > > > 
> > > > >   
> > > > >> > > > afterUri="direct:after_dispatch">
> > > > > 
> > > > > ${headers.messageType} != null &&
> > > > > ${headers.serviceType} != null
> > > > > 
> > > > > 
> > > > >   
> > > > >   
> > > > > 
> > > > >   ${headers.messageType} == 'Property'
> > > > >> > > > uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > > > > 
> > > > > .
> > > > > .
> > > > > .
> > > > >
> > > > > I found several issues listed below ordered by bug likelihood:
> > > > >
> > > > > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match 
> > > > > as
> > > > > I expect. I debugged and saw that Camel tries to match
> > > > > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> > > > > "http://localhost:8080/camel/external_mock/*"; (because ext.url is set 
> > > > > to
> > > > > http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> > > > > is right but why it's removed "/Property${headers.serviceType}" from 
> > > > > the
> > > > > interceptedUri?! because it has dynamics? it doesn't match because 
> > > > > it's
> > > > > removed this portion. I expect Camel to match
> > > > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> > > > > not "http://localhost:8080?bridgeEndpoint=true";.
> > > > >
> > > > > 2. As you see I've defined it at route level but I see all of my other
> > > > > "http:*" endpoints will be intercepted! Is this expected?!
> > > > >
> > > > > 3. As per Camel docs, when `when` condition evaluates to false then 
> > > > > the
> > > > > interception shouldn't being triggered, but I see yes, it doesn't go 
> > > > > to
> > > > > the "direct:req_out" but always go to the afterUri i.e.
> > > > > "direct:after_dispatch" regardless of `when`! Is this expected?
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > > > Regards.
> > > >
> > > >
> > > >
> > > > -

Re: Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-18 Thread Claus Ibsen
Hi

You cannot do route scoped intercepting, it's always global scoped.
The XML DSL just has a "flaw" as it is auto generated that it may
expose the intercept as being available inside a  element.


On Tue, May 18, 2021 at 10:04 PM Yasser Zamani  wrote:
>
>
>
> On 2021/05/18 18:03:47 Claus Ibsen wrote:
> > Hi
> >
> > That is because you use toD with http that camel optimizes under the
> > hood to use a base endpoint and using headers with the dynamic
> > context-path part.
> > The interceptor can then not match that pattern.
> >
> > You can turn this off in toD
> > Or you can check the header (CamelHttpPath is the name I think) in
> >  to see if it matches that part of your context-path.
>
> Thanks for the clarification! This is the place where issue#3 emerges: 
> afterUri will be triggered always regardless of the when evaluation result. 
> Is this expected? Camel docs say it won't be triggered at all when condition 
> is false.
>
> The root cause of my findings was issue#2. I've defined interception at route 
> level but it intercepts all http endpoints inside the camel context. Is this 
> expected? If so then why am I allowed to define it in route scope?
>
> Regards.
>
> >
> > On Tue, May 18, 2021 at 7:58 PM Yasser Zamani  
> > wrote:
> > >
> > > Thanks for the quick reply!
> > >
> > > (please see in-line)
> > >
> > > On 2021/05/18 15:59:34, Claus Ibsen  wrote:
> > > > Hi
> > > >
> > > > What Camel version do you use?
> > >
> > > I use Camel 3.7.3.
> > >
> > > >
> > > > Also mind about matching by exact uri, then the order of the query
> > > > parameters also matter. So if that is not really what you need, then
> > >
> > > Matching by exact uri isn't possible in my case. But to test I'd also 
> > > tested an absolute uri 
> > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";
> > >  which didn't work. The problem isn't order of query parameters. As I 
> > > said the problem is I don't know why but my break point showed me that 
> > > Camel is trying to test 
> > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
> > >  which doesn't match because the "/camel/external_mock/" is missing in 
> > > the intercepted uri, provided it is present in the exact uri or wildcard 
> > > uri expression.
> > >
> > > My best guess is that's because of my dynamic .toD where I have 
> > > ${headers.serviceType} included in the http url. For example I guess 
> > > following simplified XML DSL won't work as well:
> > >
> > > http://localhost:8080/*";>
> > >   
> > > 
> > > 
> > >   
> > >> > uri="http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>
> > >
> > > BTW any idea about issues #2 and #3?
> > >
> > > Regards.
> > >
> > > > use a * to match with wildcard
> > > >
> > > > On Tue, May 18, 2021 at 5:17 PM Yasser Zamani  
> > > > wrote:
> > > > >
> > > > > Hi there,
> > > > >
> > > > > Assume following XML DSL:
> > > > >
> > > > > 
> > > > >   
> > > > >> > > > afterUri="direct:after_dispatch">
> > > > > 
> > > > > ${headers.messageType} != null &&
> > > > > ${headers.serviceType} != null
> > > > > 
> > > > > 
> > > > >   
> > > > >   
> > > > > 
> > > > >   ${headers.messageType} == 'Property'
> > > > >> > > > uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > > > > 
> > > > > .
> > > > > .
> > > > > .
> > > > >
> > > > > I found several issues listed below ordered by bug likelihood:
> > > > >
> > > > > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't match 
> > > > > as
> > > > > I expect. I debugged and saw that Camel tries to match
> > > > > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" i.e.
> > > > > "http://localhost:8080/camel/external_mock/*"; (because ext.url is set 
> > > > > to
> > > > > http://localhost:8080/camel/external_mock) and it doesn't match, Camel
> > > > > is right but why it's removed "/Property${headers.serviceType}" from 
> > > > > the
> > > > > interceptedUri?! because it has dynamics? it doesn't match because 
> > > > > it's
> > > > > removed this portion. I expect Camel to match
> > > > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";,
> > > > > not "http://localhost:8080?bridgeEndpoint=true";.
> > > > >
> > > > > 2. As you see I've defined it at route level but I see all of my other
> > > > > "http:*" endpoints will be intercepted! Is this expected?!
> > > > >
> > > > > 3. As per Camel docs, when `when` condition evaluates to false then 
> > > > > the
> > > > > interception shouldn't being triggered, but I see yes, it doesn't go 
> > > > > to
> > > > > the "direct:req_out" but always go to the afterUri i.e.
> > > > > "direct:after_dispatch" regardless of `when`! Is this expected?
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > > 

Re: Re: interceptSendToEndpoint interceptedUri, scope and when issues

2021-05-19 Thread Yasser Zamani



On 2021/05/19 05:32:16, Claus Ibsen  wrote: 
> Hi
> 
> You cannot do route scoped intercepting, it's always global scoped.
> The XML DSL just has a "flaw" as it is auto generated that it may
> expose the intercept as being available inside a  element.

Hi Claus,

Thanks for the clarification! Actually I thought it will intercept only route 
scope endpoints because I'd seen that you've said that "The interceptor only 
applies for all routes in the same route builder class" [1]. Looks like instead 
of route I should use a route builder xml element?

Regards.

[1] https://stackoverflow.com/a/29032760/1362623

> 
> 
> On Tue, May 18, 2021 at 10:04 PM Yasser Zamani  
> wrote:
> >
> >
> >
> > On 2021/05/18 18:03:47 Claus Ibsen wrote:
> > > Hi
> > >
> > > That is because you use toD with http that camel optimizes under the
> > > hood to use a base endpoint and using headers with the dynamic
> > > context-path part.
> > > The interceptor can then not match that pattern.
> > >
> > > You can turn this off in toD
> > > Or you can check the header (CamelHttpPath is the name I think) in
> > >  to see if it matches that part of your context-path.
> >
> > Thanks for the clarification! This is the place where issue#3 emerges: 
> > afterUri will be triggered always regardless of the when evaluation result. 
> > Is this expected? Camel docs say it won't be triggered at all when 
> > condition is false.
> >
> > The root cause of my findings was issue#2. I've defined interception at 
> > route level but it intercepts all http endpoints inside the camel context. 
> > Is this expected? If so then why am I allowed to define it in route scope?
> >
> > Regards.
> >
> > >
> > > On Tue, May 18, 2021 at 7:58 PM Yasser Zamani  
> > > wrote:
> > > >
> > > > Thanks for the quick reply!
> > > >
> > > > (please see in-line)
> > > >
> > > > On 2021/05/18 15:59:34, Claus Ibsen  wrote:
> > > > > Hi
> > > > >
> > > > > What Camel version do you use?
> > > >
> > > > I use Camel 3.7.3.
> > > >
> > > > >
> > > > > Also mind about matching by exact uri, then the order of the query
> > > > > parameters also matter. So if that is not really what you need, then
> > > >
> > > > Matching by exact uri isn't possible in my case. But to test I'd also 
> > > > tested an absolute uri 
> > > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true";
> > > >  which didn't work. The problem isn't order of query parameters. As I 
> > > > said the problem is I don't know why but my break point showed me that 
> > > > Camel is trying to test 
> > > > "http://localhost:8080/camel/external_mock/PropertyFoo?bridgeEndpoint=true".matches("http://localhost:8080?bridgeEndpoint=true";);
> > > >  which doesn't match because the "/camel/external_mock/" is missing in 
> > > > the intercepted uri, provided it is present in the exact uri or 
> > > > wildcard uri expression.
> > > >
> > > > My best guess is that's because of my dynamic .toD where I have 
> > > > ${headers.serviceType} included in the http url. For example I guess 
> > > > following simplified XML DSL won't work as well:
> > > >
> > > > http://localhost:8080/*";>
> > > >   
> > > > 
> > > > 
> > > >   
> > > >> > > uri="http://localhost:8080/Sample${headers.foo}?bridgeEndpoint=true"/>
> > > >
> > > > BTW any idea about issues #2 and #3?
> > > >
> > > > Regards.
> > > >
> > > > > use a * to match with wildcard
> > > > >
> > > > > On Tue, May 18, 2021 at 5:17 PM Yasser Zamani 
> > > > >  wrote:
> > > > > >
> > > > > > Hi there,
> > > > > >
> > > > > > Assume following XML DSL:
> > > > > >
> > > > > > 
> > > > > >   
> > > > > >> > > > > afterUri="direct:after_dispatch">
> > > > > > 
> > > > > > ${headers.messageType} != null &&
> > > > > > ${headers.serviceType} != null
> > > > > > 
> > > > > > 
> > > > > >   
> > > > > >   
> > > > > > 
> > > > > >   ${headers.messageType} == 'Property'
> > > > > >> > > > > uri="{{ext.url}}/Property${headers.serviceType}?bridgeEndpoint=true"/>
> > > > > > 
> > > > > > .
> > > > > > .
> > > > > > .
> > > > > >
> > > > > > I found several issues listed below ordered by bug likelihood:
> > > > > >
> > > > > > 1. When I change uri="http:*" to uri="{{ext.url}}/*" it doesn't 
> > > > > > match as
> > > > > > I expect. I debugged and saw that Camel tries to match
> > > > > > "http://localhost:8080?bridgeEndpoint=true"; with "{{ext.url}}/*" 
> > > > > > i.e.
> > > > > > "http://localhost:8080/camel/external_mock/*"; (because ext.url is 
> > > > > > set to
> > > > > > http://localhost:8080/camel/external_mock) and it doesn't match, 
> > > > > > Camel
> > > > > > is right but why it's removed "/Property${headers.serviceType}" 
> > > > > > from the
> > > > > > interceptedUri?! because it has dynamics? it doesn't match because 
> > > > > > it's
> > > > > > removed this portion. I expect Camel to match
> > > > > > "htt

Re: interceptSendToEndpoint broken when setting address of CxfEndpoint

2023-06-13 Thread Claus Ibsen
Hi

camel-cxf is a very old component. Yeah its not a good idea what it does,
and not sure if its really necessary.
You can try with git blame and see if you can find out some JIRA tickets or
some reason behind.

On Tue, Jun 13, 2023 at 12:08 PM Speckels, Bert 
wrote:

> Hello everyone.
>
> We have currently a problem with intercepting our cxf endpoint (sending):
>
> interceptSendToEndpoint("cxf*")
> .to("bean:mockSoapSendingInterceptor?method=mock");
>
> ---
>
> But I found the reason why intercepting does not work.
> We use java code to configure our CxfEndpoint:
>
> CxfEndpoint endpoint = (CxfEndpoint)
> camelContext.getEndpoint("cxf://OUR_ENDPOINT");
> endpoint.setAddress("http://remotehost/ws/service";);
> ...
>
> The problem is that setAddress(..) in CxfEndpoint not only set the target
> address but also replaces the endpoint uri.
> So the interceptor does not match because the endpoint uri doesn't start
> with "cxf" anymore but with "http".
>
> Here is the code from CXF:
>
> public void setAddress(String address) {
>
> super.setEndpointUri(UnsafeUriCharactersEncoder.encodeHttpURI(address));
> this.address = address;
> }
>
> Is this really a good idea to replace the endpoint uri starting with
> "cxf:" with the target url of the soap endpoint?
> ---
>
> We had some good reasons to use "setAdress" instead or passing the endpoit
> uri directly like in the following example:
>
> CxfEndpoint endpoint = (CxfEndpoint) camelContext.getEndpoint("cxf://
> http://remotehost/ws/service";);
>
> I will try to figure out why this was not possible for us.
> But in the meantime: Maybe you have some other hints for me?!
>
> With kind regards
> Bert Speckels



-- 
Claus Ibsen
-
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


AW: interceptSendToEndpoint broken when setting address of CxfEndpoint

2023-06-14 Thread Speckels, Bert
Thank you Claus.

I recently found out, why we didn't use the following code:

 CxfEndpoint endpoint = (CxfEndpoint) 
camelContext.getEndpoint("cxf://http://remotehost/ws/service";);

It happens that one of the soap service urls has query string like in the 
following example:

 CxfEndpoint endpoint = (CxfEndpoint) 
camelContext.getEndpoint("cxf://http://remotehost/ws/service?stage=INT&tenant=MyCompany";);

I think Camel does not support this because it also uses query parameters for 
configuration.

Is there any possiblity to encode the service url?

With kind recards
Bert Speckels



i.A. Bert Speckels
BU Software Factory
Smart Software Solutions



BTC Business Technology Consulting AG
Escherweg 3
26121 Oldenburg
Tel:  +49 441 3612-2294
Mobil:   +49 174 3436354
Fax: +49 441 3612-3999
E-Mail:  bert.speck...@btc-ag.com
Web: http://www.btc-ag.com/



Rechtliche Hinweise:
http://www.btc-ag.com/impressum.htm
Handelsregister: Amtsgericht Oldenburg HRB 4717
Aufsichtsratsvorsitzender: Wolfgang Mücher
Vorstand: Dr. Jörg Ritter (Vorstandsvorsitzender), Percy Hamer













Von: Claus Ibsen 
Gesendet: Dienstag, 13. Juni 2023 18:39
An: users@camel.apache.org 
Betreff: Re: interceptSendToEndpoint broken when setting address of CxfEndpoint

Hi

camel-cxf is a very old component. Yeah its not a good idea what it does,
and not sure if its really necessary.
You can try with git blame and see if you can find out some JIRA tickets or
some reason behind.

On Tue, Jun 13, 2023 at 12:08 PM Speckels, Bert 
wrote:

> Hello everyone.
>
> We have currently a problem with intercepting our cxf endpoint (sending):
>
> interceptSendToEndpoint("cxf*")
> .to("bean:mockSoapSendingInterceptor?method=mock");
>
> ---
>
> But I found the reason why intercepting does not work.
> We use java code to configure our CxfEndpoint:
>
> CxfEndpoint endpoint = (CxfEndpoint)
> camelContext.getEndpoint("cxf://OUR_ENDPOINT");
> endpoint.setAddress("http://remotehost/ws/service";);
> ...
>
> The problem is that setAddress(..) in CxfEndpoint not only set the target
> address but also replaces the endpoint uri.
> So the interceptor does not match because the endpoint uri doesn't start
> with "cxf" anymore but with "http".
>
> Here is the code from CXF:
>
> public void setAddress(String address) {
>
> super.setEndpointUri(UnsafeUriCharactersEncoder.encodeHttpURI(address));
> this.address = address;
> }
>
> Is this really a good idea to replace the endpoint uri starting with
> "cxf:" with the target url of the soap endpoint?
> ---
>
> We had some good reasons to use "setAdress" instead or passing the endpoit
> uri directly like in the following example:
>
> CxfEndpoint endpoint = (CxfEndpoint) camelContext.getEndpoint("cxf://
> http://remotehost/ws/service";);
>
> I will try to figure out why this was not possible for us.
> But in the meantime: Maybe you have some other hints for me?!
>
> With kind regards
> Bert Speckels



--
Claus Ibsen
-
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: InterceptSendToEndpoint and access the intercepted endpoint details?

2023-09-17 Thread Claus Ibsen
Hi

Yes a header with key Exchange.INTERCEPTED_ENDPOINT



On Wed, Sep 6, 2023 at 12:03 PM Mikael Koskinen  wrote:

> Hi,
>
> If I'm intercepting (using InterceptSendToEndpoint) the exchange before it
> is sent to an endpoint, can I somehow access the details of the endpoint
> which I intercepted?
>
> For example if I have Log-component in my route and I use
> InterceptSendToEndpoint to intercept the request, can I somehow check the
> details of the intercepted Log-component (like parameters etc.)?
>
> Thank you in advance.
>
> Best regards,
> Mikael
>


-- 
Claus Ibsen
-
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


AW: Camel 3.22.0 - Unexpected behavior when using interceptSendToEndpoint

2024-02-22 Thread ICS460-BAI
Nobody that can support us here?
More information needed? We are stuck here and would really appreciate any hint

Thanks Christian

Am 20.02.24, 17:42 schrieb "MÜLLER Christian (ICS460-BAI)" 
:


Hi,

Given the following setup:

interceptSendToEndpoint("jms*")
 .log("intercepted jms send!")
 .to("jms:otherQueue");

 from("direct:my-route-id")
 .routeId("my-route-id")
 .setHeader("myheader",constant("targetQueue"))
 .toD("jms:${headers.myheader}");


Expected one message sent to “targetQueue” and one sent to “otherQueue”


Actual:  one message sent to “targetQueue” and one message sent to 
“${headers.myheader}”

AMQ601500: User anonymous@127.0.0.1:63319<mailto:anonymous@127.0.0.1:63319> is 
sending a message 
CoreMessage[messageID=9,durable=true,userID=cabc1571-d00d-11ee-b7da-becf4cf7ea1d,priority=4,
 timestamp=Tue Feb 20 17:33:34 CET 2024,expiration=0, durable=true, 
address=targetQueue,size=4611,properties=TypedProperties[dataFormat=xml,__AMQ_CID=cab1670d-d00d-11ee-b7da-becf4cf7ea1d,breadcrumbId=55686e49-01f1-42ea-8cbb-0125f898c6ce,CamelCharsetName=utf-8,_AMQ_ROUTING_TYPE=1,CamelInterceptedEndpoint=jms://$%7Bheaders.myheader%7D,myheader=targetQueue,EaiImageTid=3683380,CamelFileRelativePath=TestCase1.body,ignoreElements=transaction_date;transaction_time,ImageDistributionKey=HS]]@175631139,
 with Context: RoutingContextImpl(Address=null, routingType=null, 
PreviousAddress=null previousRoute:null, reusable=null, version=0)

AMQ601500: User anonymous@127.0.0.1:63320<mailto:anonymous@127.0.0.1:63320> is 
sending a message 
CoreMessage[messageID=22,durable=true,userID=cac08247-d00d-11ee-b7da-becf4cf7ea1d,priority=4,
 timestamp=Tue Feb 20 17:33:34 CET 2024,expiration=0, durable=true, 
address=${headers.myheader},size=4627,properties=TypedProperties[dataFormat=xml,__AMQ_CID=cabf70d3-d00d-11ee-b7da-becf4cf7ea1d,breadcrumbId=55686e49-01f1-42ea-8cbb-0125f898c6ce,CamelCharsetName=utf-8,_AMQ_ROUTING_TYPE=1,CamelInterceptedEndpoint=jms://$%7Bheaders.myheader%7D,myheader=targetQueue,EaiImageTid=3683380,CamelFileRelativePath=TestCase1.body,ignoreElements=transaction_date;transaction_time,ImageDistributionKey=HS]]@46786045,
 with Context: RoutingContextImpl(Address=null, routingType=null, 
PreviousAddress=null previousRoute:null, reusable=null, version=0)


Would really appreciate any help here!

Regards Christian

[cid:image74778c.PNG@737be51a.42950889]<https://www.spar-ics.com/>

DI Christian Müller
Software Engineer
Business Automation & Integration

Mobile:
+43 664 88748100
E-Mail:
christian.muel...@spar-ics.com<mailto:christian.muel...@spar-ics.com>

SPAR Business Services GmbH
Information & Communication Services
Europastrasse 3, 5015 Salzburg, Austria

[cid:imagec108ac.PNG@6659f7c0.4f912325]

Sollten Sie diese E-Mail unbeabsichtigt bzw. irrtümlich erhalten haben, so 
weisen wir Sie darauf hin, dass gemäß § 161 Abs 4 TKG 2021 der Inhalt sowie die 
Tatsache des Empfangs dieser E-Mail weder aufgezeichnet noch verwertet oder 
Unbefugten mitgeteilt werden dürfen. Wir ersuchen Sie, die Nachricht von Ihrem 
System zu löschen und sich mit uns in Verbindung zu setzen.
Unter diesem Link finden Sie die Informationen über die Verarbeitung Ihrer 
personenbezogenen Daten sowie zu Ihren Rechten als betroffene Person:
https://www.spar.at/service/datenschutzhinweise

If you have received this email accidentally or in error, we point out that, in 
accordance with § 161 para. 4 TKG 2021 (Telecommunications Act), the contents 
of this email and the fact of its receipt must not be recorded, exploited or 
communicated to unauthorized persons. We ask you to delete the message from 
your system and to contact us.
Under this link you will find information about the processing of your personal 
data and about your rights as a data subject
https://www.spar.at/service/datenschutzhinweise




AW: Camel 3.22.0 - Unexpected behavior when using interceptSendToEndpoint

2024-02-22 Thread Diogo Costa
Hi Christian,
 
Instead of `.toD`, try using a single `jms` endpoint and control the
destination using headers. Relevant documentation here:
https://camel.apache.org/components/4.4.x/jms-component.html#_reuse_endpoint_and_send_to_different_destinations_computed_at_runtime
 
interceptSendToEndpoint("jms*")        .log("intercepted jms send!") 
      .to("jms:otherQueue");
 
from("direct:my-route-id")        .routeId("my-route-id")       
.setHeader("myheader", constant("targetQueue"))
        .setHeader("CamelJmsDestinationName",
simple("${headers.myheader}"))        .to("jms:dummy"); 
(not tested!)
 
Intercepting all exchanges to `jms*` and then sending them to a `jms`
endpoint may also be causing the issue. Perhaps add a filter to only send
the exchange if the "CamelJmsDestinationName" is not "otherqueue"?
 
Regards,
Diogo Costa
 
"MÜLLER Christian (ICS460-BAI)" christian.muel...@spar-ics.com.invalid –
22 February 2024 14:17 

> Nobody that can support us here? More information needed? We are stuck
> here and would really appreciate any hint  Thanks Christian
>  
>  
>  
> Am 20.02.24, 17:42 schrieb "MÜLLER Christian (ICS460-BAI)"
> :
>  
>  
>  
> Hi, Given the following
setup: interceptSendToEndpoint("jms*")
> .log("intercepted jms send!")
> .to("jms:otherQueue"); from("direct:my-route-id")
> .routeId("my-route-id")
> .setHeader("myheader",constant("targetQueue"))
> .toD("jms:${headers.myheader}"); 
>  
> Expected one message sent to “targetQueue” and one sent to
“otherQueue”
>  
> Actual:  one message sent to “targetQueue” and one message sent to
> “${headers.myheader}”AMQ601500: User anonymous@127.0.0.1:63319 is
> sending a message
>
CoreMessage[messageID=9,durable=true,userID=cabc1571-d00d-11ee-b7da-becf4cf7ea1d,priority=4,
timestamp=Tue Feb 20 17:33:34 CET 2024,expiration=0, durable=true,
address=targetQueue,size=4611,properties=TypedProperties[dataFormat=xml,__AMQ_CID=cab1670d-d00d-11ee-b7da-becf4cf7ea1d,breadcrumbId=55686e49-01f1-42ea-8cbb-0125f898c6ce,CamelCharsetName=utf-8,_AMQ_ROUTING_TYPE=1,CamelInterceptedEndpoint=jms://$%7Bheaders.myheader%7D,myheader=targetQueue,EaiImageTid=3683380,CamelFileRelativePath=TestCase1.body,ignoreElements=transaction_date;transaction_time,ImageDistributionKey=HS]]@175631139,
with Context: RoutingContextImpl(Address=null, routingType=null,
PreviousAddress=null previousRoute:null, reusable=null,
version=0)AMQ601500: User anonymous@127.0.0.1:63320 is sending a message
CoreMessage[messageID=22,durable=true,userID=cac08247-d00d-11ee-b7da-becf4cf7ea1d,priority=4,
timestamp=Tue Feb 20 17:33:34 CET 2024,expiration=0, durable=true,
address=${headers.myheader},size=4627,properties=TypedProperties[dataFormat=xml,__AMQ_CID=cabf70d3-d00d-11ee-b7da-becf4cf7ea1d,breadcrumbId=55686e49-01f1-42ea-8cbb-0125f898c6ce,CamelCharsetName=utf-8,_AMQ_ROUTING_TYPE=1,CamelInterceptedEndpoint=jms://$%7Bheaders.myheader%7D,myheader=targetQueue,EaiImageTid=3683380,CamelFileRelativePath=TestCase1.body,ignoreElements=transaction_date;transaction_time,ImageDistributionKey=HS]]@46786045,
with Context: RoutingContextImpl(Address=null, routingType=null,
PreviousAddress=null previousRoute:null, reusable=null, version=0)Would
really appreciate any help here! Regards
> Christian
>  
>  
>
>  
>   DI Christian MüllerSoftware EngineerBusiness Automation &
Integration
>  
>
>  
> Mobile:
>  
> +43 664 88748100
>  
> E-Mail:
>  
> christian.muel...@spar-ics.com
>  
>  
>  
> SPAR Business Services GmbHInformation & Communication
> ServicesEuropastrasse 3, 5015 Salzburg, Austria
>  
>
>  
>  
>  
> Sollten Sie diese E-Mail unbeabsichtigt bzw. irrtümlich erhalten haben,
> so weisen wir Sie darauf hin, dass gemäß § 161 Abs 4 TKG 2021 der
Inhalt
> sowie die Tatsache des Empfangs dieser E-Mail weder aufgezeichnet noch
> verwertet oder Unbefugten mitgeteilt werden dürfen. Wir ersuchen Sie,
> die Nachricht von Ihrem System zu löschen und sich mit uns in Verbindung
> zu setzen.Unter diesem Link finden Sie die Informationen über die
> Verarbeitung Ihrer personenbezogenen Daten sowie zu Ihren Rechten als
> betroffene Person:https://www.spar.at/service/datenschutzhinweiseIf you
> have received this email accidentally or in error, we point out that, in
> accordance with § 161 para. 4 TKG 2021 (Telecommunications Act), the
> contents of this email and the fact of its receipt must not be recorded,
> exploited or communicated to unauthorized persons. We ask you to delete
> the message from your system and to contact us. Under this link you will
> find information about the processing of your personal data and about
> your rights as a data
> subjecthttps://www.spar.at/service/datenschutzhinweise
>  
>  
>  

Re: How to use InterceptSendToEndpoint from Java DSL

2018-06-08 Thread Claus Ibsen
Hi

You put it in each of your RouteBuilder classes, or in a abstract
super class of yours, and then call super.configure() for each of your
routes.

You can find examples of using it in the camel-core unit tests itself,
just do a git grep.



On Fri, Jun 8, 2018 at 5:40 PM, Jackson, Douglas
 wrote:
> Hi!
> I need to replace my blueprint DSL with Java DSL. I want to intercept all 
> attempts to send to certain queues, not just for one route, but for 
> everything.
> Here is the blueprint DSL:
>
> http://camel.apache.org/schema/blueprint";>
>
>  uri="direct:queued-Intercept"/>
>  uri="direct:queued-Intercept"/>
>      uri="direct:queued-Intercept"/>
>
> When I put calls to the interceptSendToEndpoint() method in a RouteBuilder 
> configure method, they did not work.
>
>
> The java documentation on the InterceptSendToEndpoint is poor. I have also 
> found no good examples.
>
>
> Douglas Jackson
>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


RE: How to use InterceptSendToEndpoint from Java DSL

2018-06-08 Thread Jackson, Douglas
Is there no way to do it without attaching it to specific routes the way we did 
it in the blueprint DSL?

We want to have the interceptor fire whenever someone sends a message to one of 
the queues regardless of which route they use.  Attaching it to a specific 
route does not accomplish that.

Perhaps camelContext.addEndpoint() with some InterceptSendToEndpoint 
construction?
-Doug


Re: How to use InterceptSendToEndpoint from Java DSL

2018-06-08 Thread Claus Ibsen
Hi

Ah okay yeah you can have it in one route builder, where you can have
all your interceptors. Then during startup it will re-register any
existing endpoints with itself so it can proxy/detour.

For doing this manually yourself, then see the source code of
InterceptSendToEndpointDefinition

On Fri, Jun 8, 2018 at 6:21 PM, Jackson, Douglas
 wrote:
> Is there no way to do it without attaching it to specific routes the way we 
> did it in the blueprint DSL?
>
> We want to have the interceptor fire whenever someone sends a message to one 
> of the queues regardless of which route they use.  Attaching it to a specific 
> route does not accomplish that.
>
> Perhaps camelContext.addEndpoint() with some InterceptSendToEndpoint 
> construction?
> -Doug



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


RE: How to use InterceptSendToEndpoint from Java DSL

2018-06-08 Thread Jackson, Douglas
Hi!
Thanks so much for responding.  It is awesome to have someone of your caliber 
answering my questions!

> Ah okay yeah you can have it in one route builder, where you can have
> all your interceptors. Then during startup it will re-register any
> existing endpoints with itself so it can proxy/detour.

My initial attempt was to create a RouteBuilder and in the configure method 
call the interceptSendToEndpoint() method a few times.

  camelContext.addRoutes(new RouteBuilder() {
   @Override
   public void configure()
   throws Exception {
  
interceptSendToEndpoint("activemq:queue:.*-xxx").to("direct:queued-Interceptor");
  
interceptSendToEndpoint("activemq:queue:.*-xxx-dlq").to("direct:queued-Interceptor");
  
interceptSendToEndpoint("activemq:queue:.*-xxx-paused").to("direct:queued-Interceptor");
   }
});
However, the queued-interceptor route was never fired when a message was posted 
to activemq.
So I assumed that those interceptors were not acting beyond the context of the 
route.
-Doug


Re: How to use InterceptSendToEndpoint from Java DSL

2018-06-09 Thread Claus Ibsen
Hi

Here is an example how to do it
https://github.com/apache/camel/commit/82286514db9404418b078319fde1af32e0bc0ebb

On Fri, Jun 8, 2018 at 7:16 PM, Jackson, Douglas
 wrote:
> Hi!
> Thanks so much for responding.  It is awesome to have someone of your caliber 
> answering my questions!
>
>> Ah okay yeah you can have it in one route builder, where you can have
>> all your interceptors. Then during startup it will re-register any
>> existing endpoints with itself so it can proxy/detour.
>
> My initial attempt was to create a RouteBuilder and in the configure method 
> call the interceptSendToEndpoint() method a few times.
>
>   camelContext.addRoutes(new RouteBuilder() {
>@Override
>public void configure()
>throws Exception {
>   
> interceptSendToEndpoint("activemq:queue:.*-xxx").to("direct:queued-Interceptor");
>   
> interceptSendToEndpoint("activemq:queue:.*-xxx-dlq").to("direct:queued-Interceptor");
>   
> interceptSendToEndpoint("activemq:queue:.*-xxx-paused").to("direct:queued-Interceptor");
>}
> });
> However, the queued-interceptor route was never fired when a message was 
> posted to activemq.
> So I assumed that those interceptors were not acting beyond the context of 
> the route.
> -Doug



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


RE: How to use InterceptSendToEndpoint from Java DSL

2018-06-11 Thread Jackson, Douglas
Hi!
I think there is something wrong with our camel context. Not sure what.
We were creating a camel context in blueprints [karaf 4.1.4] using the 
 tag, and then trying to replace the activemq component with a 
new one with a failover() url in java (removeComponent('activemq'), 
addComponent('activemq')), however when the camel context was started the wrong 
activemq was used.
So, I switched the blueprint to construct a camel context by doing the 
something like the following:
, then in the java I set a 'mymq' component 
with a sub class of the activemq component that creates a SendToIntercept 
endpoint as needed.
That works, not ideal. However, now the error handler that I am creating via 
Java DSL does not appear to fire when a failure occurs on the route.
Any ideas what might be missing on the camel context created that way such that 
the interceptors and error handlers do not seem to register correctly?
-Doug

From: Jackson, Douglas (DF PL LCS CF SEPL SEF ING)
Sent: Friday, June 8, 2018 12:17 PM
To: users@camel.apache.org
Subject: RE: How to use InterceptSendToEndpoint from Java DSL

Hi!
Thanks so much for responding.  It is awesome to have someone of your caliber 
answering my questions!

> Ah okay yeah you can have it in one route builder, where you can have
> all your interceptors. Then during startup it will re-register any
> existing endpoints with itself so it can proxy/detour.
My initial attempt was to create a RouteBuilder and in the configure method 
call the interceptSendToEndpoint() method a few times.

  camelContext.addRoutes(new RouteBuilder() {
   @Override
   public void configure()
   throws Exception {
      
interceptSendToEndpoint("activemq:queue:.*-xxx").to("direct:queued-Interceptor");
  
interceptSendToEndpoint("activemq:queue:.*-xxx-dlq").to("direct:queued-Interceptor");
  
interceptSendToEndpoint("activemq:queue:.*-xxx-paused").to("direct:queued-Interceptor");
   }
});
However, the queued-interceptor route was never fired when a message was posted 
to activemq.
So I assumed that those interceptors were not acting beyond the context of the 
route.
-Doug


RE: How to use InterceptSendToEndpoint from Java DSL

2018-06-11 Thread Jackson, Douglas
Hi!
FYI - I am using camel 2.20.1.
I have been attempting to debug the camel code. In the RouteDefinition, it 
seems that the contextScopedErrorHandler flag is set to true even though there 
is an errorHandlerBuilder attached (DeadLetterChannelBuilder).

In the RouteDefinitionHelper method initParentAndErrorHandlerBuilder, there is 
no code that touches the error handler - method name seems outdated.
-Doug



Unable to shutdown endpoint when intercepted with interceptSendToEndpoint

2015-06-25 Thread gterral
Hello,

I'm facing an issue with the version of camel 2.15.2

I have a component that create an endpoint.

This endpoint override the shutdown and doShutdown method so we can log
values at shutdown time.

But when this endpoint is intercept with the interceptSendToEnpoint method
the shutdown is not called.

Here is an example of code to reproduce:

the Component:


the Endpoint:


the route:


When there is an interceptor the shutdown on the endpoint is not called,
when there is no interceptor the shutdown is called.

After some debugging I noticed that in the DefaultCamelContext at the
shutdown time the shutdown is called on the list of endpoints, when there is
an interceptor the list do not contain the CustomEnpoint but only the
Interceptor, and because the interceptor does not implement
ShutdownableAware the shutdown is not propagate to the underlying endpoint
(here the CustomEndpoint)

Without the interceptor the CustomEndpoint appears in the list and the
shutdown method is called.

Is this expected or not ? 

If it's not should I create an issue on your Jira ?

Thanks in advance,

Guillaume




--
View this message in context: 
http://camel.465427.n5.nabble.com/Unable-to-shutdown-endpoint-when-intercepted-with-interceptSendToEndpoint-tp5768574.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unable to shutdown endpoint when intercepted with interceptSendToEndpoint

2015-06-28 Thread Claus Ibsen
Hi

Yeah seems like a little bug, you are welcome to log a ticket

On Thu, Jun 25, 2015 at 11:53 AM, gterral  wrote:
> Hello,
>
> I'm facing an issue with the version of camel 2.15.2
>
> I have a component that create an endpoint.
>
> This endpoint override the shutdown and doShutdown method so we can log
> values at shutdown time.
>
> But when this endpoint is intercept with the interceptSendToEnpoint method
> the shutdown is not called.
>
> Here is an example of code to reproduce:
>
> the Component:
>
>
> the Endpoint:
>
>
> the route:
>
>
> When there is an interceptor the shutdown on the endpoint is not called,
> when there is no interceptor the shutdown is called.
>
> After some debugging I noticed that in the DefaultCamelContext at the
> shutdown time the shutdown is called on the list of endpoints, when there is
> an interceptor the list do not contain the CustomEnpoint but only the
> Interceptor, and because the interceptor does not implement
> ShutdownableAware the shutdown is not propagate to the underlying endpoint
> (here the CustomEndpoint)
>
> Without the interceptor the CustomEndpoint appears in the list and the
> shutdown method is called.
>
> Is this expected or not ?
>
> If it's not should I create an issue on your Jira ?
>
> Thanks in advance,
>
> Guillaume
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Unable-to-shutdown-endpoint-when-intercepted-with-interceptSendToEndpoint-tp5768574.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Unable to shutdown endpoint when intercepted with interceptSendToEndpoint

2015-06-29 Thread gterral
Ticket logged under: 

https://issues.apache.org/jira/browse/CAMEL-8914

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unable-to-shutdown-endpoint-when-intercepted-with-interceptSendToEndpoint-tp5768574p5768646.html
Sent from the Camel - Users mailing list archive at Nabble.com.


is that possible to use properties in the uri attribute of InterceptSendToEndpoint?

2010-11-02 Thread yli

Hi All,
I am trying to use properties in the uri part of
InterceptSendToEndpoint, but no luck.
Here is example code(I am using spring and Camel 2.4):






 ...
 
 
 
 ...


In the property file "common.properties", I have "sendingURL=
http://10.1.201.225/myService";.
As you may have figured out, I wanted to intercept all messages that
are sent to an http endpoint(http://10.1.201.225/myService) and print
"intercepted!" in the log.
I have also tried to use uri="${properties:sendingURL}", but it
didn't work either.
However, when I replaced uri="{{sendingURL}}" with uri="
http://10.1.201.225/myService";, it just worked.

Please correct me if I missed anything in the usage of properties
component and the intercepter.

When reading the camel document(
http://camel.apache.org/intercept.html), I found InterceptSendToEndpoint is
"dynamic" and supports wildcard and regular expression. Doesn't it support
properties?
 Thank you very much.

Best
Yiming

-- 
View this message in context: 
http://camel.465427.n5.nabble.com/is-that-possible-to-use-properties-in-the-uri-attribute-of-InterceptSendToEndpoint-tp3247537p3247537.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: is that possible to use properties in the uri attribute of InterceptSendToEndpoint?

2010-11-02 Thread Claus Ibsen
Hi

This is possible with Camel 2.5 onwards. (CAMEL-3210)


On Tue, Nov 2, 2010 at 10:16 PM, yli  wrote:
>
> Hi All,
>        I am trying to use properties in the uri part of
> InterceptSendToEndpoint, but no luck.
>        Here is example code(I am using spring and Camel 2.4):
>
>         class="org.apache.camel.component.properties.PropertiesComponent" />
>            
>        
>
>        
>             ...
>             
>                 
>             
>             ...
>        
>
>        In the property file "common.properties", I have "sendingURL=
> http://10.1.201.225/myService";.
>        As you may have figured out, I wanted to intercept all messages that
> are sent to an http endpoint(http://10.1.201.225/myService) and print
> "intercepted!" in the log.
>        I have also tried to use uri="${properties:sendingURL}", but it
> didn't work either.
>        However, when I replaced uri="{{sendingURL}}" with uri="
> http://10.1.201.225/myService";, it just worked.
>
>        Please correct me if I missed anything in the usage of properties
> component and the intercepter.
>
>        When reading the camel document(
> http://camel.apache.org/intercept.html), I found InterceptSendToEndpoint is
> "dynamic" and supports wildcard and regular expression. Doesn't it support
> properties?
>         Thank you very much.
>
> Best
> Yiming
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/is-that-possible-to-use-properties-in-the-uri-attribute-of-InterceptSendToEndpoint-tp3247537p3247537.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/