You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cheekychops <sm...@hotmail.com> on 2013/03/01 12:07:56 UTC

direct-vm and CamelBlueprintTestSupport

Hi, 

I've just split a camel context in two and connected them using direct-vm
like this:

<camelContext id="blueprintJmsContext"
xmlns="http://camel.apache.org/schema/blueprint" trace="false">
<route id="inbound">
<from uri="activemq:inbound" />
<to uri="direct-vm:validator" />
</route>
</camelContext>

<camelContext id="blueprintContext"
xmlns="http://camel.apache.org/schema/blueprint" trace="false">
<route id="validator">
<from uri="direct-vm:validator" />
...
</route>
</camelContext>

Now my unit tests on blueprintContext fail randomly (sometimes they pass),
with errors like:

java.lang.IllegalStateException: A consumer Consumerdirect-vm://validator
already exists from CamelContext: blueprintContext. Multiple consumers not
supported
at
org.apache.camel.component.directvm.DirectVmComponent.addConsumer(DirectVmComponent.java:57)

Is there a way to avoid this with CamelBlueprintTestSupport?

Many thanks,

Colin Smith




--
View this message in context: http://camel.465427.n5.nabble.com/direct-vm-and-CamelBlueprintTestSupport-tp5728344.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: direct-vm and CamelBlueprintTestSupport

Posted by cheekychops <sm...@hotmail.com>.
This is part of a FUSE ESB deployment, so its version 2.10.0.fuse-71-047 of
Camel.

My test class extends CamelBlueprintTestSupport. I use a producerTemplate to
send to the endpoint, like this:

	@Produce(uri = "direct-vm:validator")
	protected ProducerTemplate validatorProducer;
...
		Response response = validatorProducer.requestBody(request,
Response.class);

Different test methods fail each time I run the test.

I get similar results (random tests failing, and the error "No consumers
available on endpoint: Endpoint[direct://validator]") when I try to use
"direct:validator". Someone on my team has suggested that it is not possible
to start a route with only direct: endpoints, which is what I'm trying to
do. 

My reason for doing this is to try to separate out all the activemq config
into its own route, and bridge the two contexts using direct-vm. I'm pretty
new to this so there may be a better way.



--
View this message in context: http://camel.465427.n5.nabble.com/direct-vm-and-CamelBlueprintTestSupport-tp5728344p5728355.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: direct-vm and CamelBlueprintTestSupport

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel do you use?

And what / how do you run your unit test?

On Fri, Mar 1, 2013 at 12:07 PM, cheekychops <sm...@hotmail.com> wrote:
> Hi,
>
> I've just split a camel context in two and connected them using direct-vm
> like this:
>
> <camelContext id="blueprintJmsContext"
> xmlns="http://camel.apache.org/schema/blueprint" trace="false">
> <route id="inbound">
> <from uri="activemq:inbound" />
> <to uri="direct-vm:validator" />
> </route>
> </camelContext>
>
> <camelContext id="blueprintContext"
> xmlns="http://camel.apache.org/schema/blueprint" trace="false">
> <route id="validator">
> <from uri="direct-vm:validator" />
> ...
> </route>
> </camelContext>
>
> Now my unit tests on blueprintContext fail randomly (sometimes they pass),
> with errors like:
>
> java.lang.IllegalStateException: A consumer Consumerdirect-vm://validator
> already exists from CamelContext: blueprintContext. Multiple consumers not
> supported
> at
> org.apache.camel.component.directvm.DirectVmComponent.addConsumer(DirectVmComponent.java:57)
>
> Is there a way to avoid this with CamelBlueprintTestSupport?
>
> Many thanks,
>
> Colin Smith
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/direct-vm-and-CamelBlueprintTestSupport-tp5728344.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: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen