activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dr.jeff" <>
Subject [camel] using camel spring container
Date Sat, 28 Apr 2007 23:29:30 GMT

I have tried and completely failed to use the camel spring container.

I see where it can do two things:

1) create a context which instantiates RouteBuilders in a given package:
  <bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean">
    <property name="packages" value="org.apache.camel.spring.example"/>
I can't even guess what the need for that is, unless it's just a shortcut
for declaring those RouteBuilders in the xml.

2) create RouteBuilders in xml:
    <routeBuilder id="buildSimpleRoute"
         <from uri="queue:a"/>
         <to uri="queue:b"/>
That seems more useful, since I can get the routes and add them to a
CamelContext, like this:
	container = new DefaultCamelContext();
	//or: container = SpringCamelContext.springCamelContext(ctx);
	Map<String, RouteBuilder> map = ctx.getBeansOfType(RouteBuilder.class);
	Iterator<RouteBuilder> iter = map.values().iterator();
	List<Route> routes = new ArrayList<Route>();
	while(iter.hasNext()) {
		RouteBuilder builder =;
		try {
		} catch (Exception e) {

The problem is, the routes don't work.

I f I pass a message in, it doesn't go anywhere:
        Endpoint<Exchange> endpoint = container.getEndpoint("queue:a");
        Exchange exchange = endpoint.createExchange();
        Message m = exchange.getIn();
        Producer<Exchange> producer = endpoint.createProducer();

So something is missing, probably in my understanding of how the
camel-spring component is supposed to work.
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message