camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdeacon <>
Subject Body expression not resolving to bean in velocity
Date Mon, 06 Jul 2015 14:07:49 GMT

I do apologize in advance if this question has been posted before.  I was
not able to find any relevant content.  I have the following Route...
defined in this Java class...

Camel Version 2.10.0
Spring 3.0.7Release
velocity 1.7

package camelinaction;

import javax.jms.ConnectionFactory;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
import org.apache.camel.impl.DefaultCamelContext;

 * Main class to execute start the camel context and convert the csv file
 * to a velocity template that can change over time.
 * @author XGD93501 Garrett Deacon
public class DynamicVelocityMain {

	 * @param args
	public static void main(String[] args) {
	      // create CamelContext
        CamelContext context = new DefaultCamelContext();
        // connect to embedded ActiveMQ JMS broker
        ConnectionFactory connectionFactory = 
            new ActiveMQConnectionFactory("vm://localhost");

        // add our route to the CamelContext
        try {
			context.addRoutes(new RouteBuilder() {
			    public void configure() {
			        // load file orders from src/data into the JMS queue
			        BindyCsvDataFormat bindy = new
			    		.process(new Processor() {
			    			public void process(Exchange exchange) throws Exception {
			    				CustomerBean bean = exchange.getIn(CustomerBean.class);
			    				exchange.getIn().setBody(bean, CustomerBean.class);
//			        from("file:src/data").unmarshal(bindy)
//			        	.to("velocity:dummy")
//			    		.to("file:src/out");			        

	        // start the route and let it do its work

	        // stop the CamelContext
		} catch (Exception e) {
			// TODO Auto-generated catch block



I'm sending the result from bindy to a velocity template below...

The crazy brown fox jumped over the lazy cow

Hello, ${body.firstName} ${body.lastName}

When I look at the final file generated it does not resolve to the
properties of the CustomerBean.  What am I doing wrong?  Any help or
pointers greatly appreciated.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message