camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmvwx <>
Subject Cant call bean's function. XML
Date Tue, 16 Sep 2014 18:40:13 GMT
Hi, I'm very new to Camel. I'm just trying to get my object's method to be
called. I know that spring finds the bean so thats good.


package tutorial.simple.route;
import java.util.ArrayList;
import java.util.HashMap;

import org.apache.camel.Handler;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public class MockSql {
private static final Logger log = Logger.getLogger("mockSql");
	public MockSql(){
		log.debug("constructed mock sql");
	public ArrayList populate(){
		ArrayList <HashMap> ary = new ArrayList<HashMap>();
		HashMap<String, String> hm = new HashMap();
		HashMap<String, String> hm2 = new HashMap();
		hm.put("n1", "j1");
		hm2.put("n2", "j2");
		log.debug("populated mock sql");
		return ary;


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<bean id="mockSql" class="tutorial.simple.route.MockSql"/>

<camelContext id="camel" xmlns="">
        <from uri="direct:start"/>
        <log loggingLevel="DEBUG" message="logger" id="123"
        <to uri="bean:mockSql?method=populate()"/>


[pache.camel.spring.Main.main()] MainSupport                    INFO  Apache
Camel 2.12.0.redhat-610379 starting
[pache.camel.spring.Main.main()] mockSql                        DEBUG
constructed mock sql
[pache.camel.spring.Main.main()] SpringCamelContext             INFO  Apache
Camel 2.12.0.redhat-610379 (CamelContext: camel) is starting
[pache.camel.spring.Main.main()] ManagedManagementStrategy      INFO  JMX is
[pache.camel.spring.Main.main()] DefaultTypeConverter           INFO  Loaded
176 type converters
[pache.camel.spring.Main.main()] SpringCamelContext             INFO 
AllowUseOriginalMessage is enabled. If access to the original message is not
needed, then its recommended to turn this option off as it may improve
[pache.camel.spring.Main.main()] SpringCamelContext             INFO 
StreamCaching is not in use. If using streams then its recommended to enable
stream caching. See more details at
[pache.camel.spring.Main.main()] SpringCamelContext             INFO  Route:
route1 started and consuming from: Endpoint[direct://start]
[pache.camel.spring.Main.main()] SpringCamelContext             INFO  Total
1 routes, of which 1 is started.
[pache.camel.spring.Main.main()] SpringCamelContext             INFO  Apache
Camel 2.12.0.redhat-610379 (CamelContext: camel) started in 0.324 seconds

as you can see, "populate" is never called.

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

View raw message