You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Larry Meadors <la...@gmail.com> on 2012/02/29 00:06:33 UTC

Testing a route that uses an intermediate endpoint

I have a route that looks something like this (I'm abbreviating it to
make it more direct what I'm trying to test):


from(middleEndpoint).doSomeOtherMagic().to(somewhereElse);
from(jmsQueue).doSomeMagic().to(middleEndpoint);


Based on the doSomeMagic() part, it may or may not end up sending the
message to the middleEndpoint endpoint.

In my test, I want to verify that under the right conditions, messages
go where they should.

I inject the endpoints and was hoping I could use
"mock:middleEndpoint" for that, but that makes camel bark at me saying
"You cannot consume from this endpoint".

Which FM do I need to read? :)

Larry

Re: Testing a route that uses an intermediate endpoint

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

The Mock endpoint is not like a consumer/server that receives a message and
sends a response with another message. The mock endpoint is a dead-end
endpoint only receive messages and assert based on the fact that it met
certain criteria.

This is why it cannot be a consumer endpoint in camel and used in
from("mock:XXX") since it is unable to push an exchange further down the
route to other route segments (i.e. dosomeOtherMagic()).

You might want to use the Direct or SEDA/VM components to achieve your
objective instead of Mock...

Hope this explains the issue and its resolution.

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/Testing-a-route-that-uses-an-intermediate-endpoint-tp5523537p5525385.html
Sent from the Camel - Users mailing list archive at Nabble.com.