Hi everyone.
I am dealing with issue tracing route and got some problems.
My Camel routing is done by spring configuration.
The idea is the following. I need to be able to trace some route – saying to
write down in DB when has message last time passed through this route.
I have created processor which has private “Date lastMessageDate” field.
And saving the last date
public void process(Exchange exchange) throws Exception {
this.lastMessageDate = new Date();
}
In the route which I need to be traced I add processor
<process ref="routeTracer "/>
Added this bean to my Sping Context
<bean id="routeTracer" class=" util.MessageDateProcessor">
<property name="routeName" value="route1"/>
</bean>
And I started route with timer which periodically send message to my
routeTracer bean method retrieve the lastMessageDate data and send it to sql
endpoint
<route>
<from ref="timer://foo?fixedRate=true&period=5000"/>
<to uri="bean:routeTracer?method=setLastMessageDate"/>
<to uri="sql:insert into RouteTrace (route_name,
last_passing_date) values (#,#)?dataSourceRef=myDS"/>
</route>
The problem is that I get error
, BodyType:null
, Body:Message: [Body is null]
, CaughtExceptionType:org.springframework.jdbc.UncategorizedSQLException,
CaughtExceptionMessage:PreparedStatementCallback; uncategorized SQLException
for SQL [
insert into RouteTrace (route_name, last_passing_date) values (?, ?)]; SQL
state [null]; error code [0]; Number of parameters mismatch. Expected: 2,
was:0; nested exception is java.sql.SQLException: Number of parameters
mismatch. Expected: 2, was:0] {logger}
It seems the message isn’t sent to the bean:routeTracer(<to
uri="bean:routeTracer?method=setLastMessageDate"/> )
Can someone help me to understand what I am doing wrong?
--
View this message in context:
http://camel.465427.n5.nabble.com/Problem-with-setting-message-tp3319402p3319402.html
Sent from the Camel - Users mailing list archive at Nabble.com.