You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by prgtrdr <bi...@hartsandco.com> on 2013/08/29 16:31:48 UTC
QuickfixJ Message Map?
Hi, I've been trying to get a route to work with the Camel Quickfix
implementation and could use some help. All I'm trying to do is create a
route that accepts messages from QuickfixJ and stores them in a SQL Server
database via the camel sql component and the MS JDBC driver. So I created
the following just to see if I could insert a static record into the
database:
<route>
<from uri="timer:foo?period=60s"/>
<filter>
<simple>${header.MessageType} in 6,7</simple>
<to uri="sqlOMM:insert into OMM.dbo.IOIs (id, IDSource,
IOIid, Symbol, IOIShares, SecurityDesc, Price, IOINatural) VALUES (1,
'BILLSOURCE', '0001', 'HOG', 12345, 'Harley Davidson', 32.00, 'Y')"/>
</filter>
</route>
<bean id="ommdb"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url"
value="jdbc:sqlserver://localhost:1433;integratedSecurity=true;databaseName=OMM"/>
</bean>
<bean id="sqlOMM" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="ommdb"/>
</bean>
This works fine, i.e., a new record is inserted into the database every 60
seconds.
But then I replace the timer URI with a Quickfix URI like this:
<from uri="quickfix:config.cfg"/>
I know the Quickfix config is working ok as I use it elsewhere. But upon
receipt of a valid FIX message this generates the log message:
org.springframework.dao.TransientDataAccessResourceException:
PreparedStatementCallback; SQL [insert into OMM.dbo.IOIs (id, IDSource,
IOIid, Symbol, IOIShares, SecurityDesc, Price, IOINatural) VALUES (2,
'BILLSOURCE', '0001', 'HOG', 12345, 'Harley Davidson', 32.00, 'Y')]; The
index 1 is out of range.; nested exception is
com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is out of
range.
at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:106)
at ( REMAINING STACK TRACE BELOW)
It's strange because I'm not even trying to access the Quickfix message (but
it's probably being accessed by the sql bean anyway). After a lot of
Googleing and reading I think this may be caused be an incompatibility
between the Quickfix Exchange Message and the SQL component. Here's how I'm
thinking about it.
The Camel QuickfixJ component generates a quickfix.Message which is a
FieldMap which derived from TreeMap. According to the Camel sql component
documentation, it should accept a Map as input and allow specification of
fields in the insert statement. Is this right? Or do I need to write some
kind of converter?
If the Quickfix message is being sent as a Map, shouldnt I be able to use a
log statement like,
<log message="About to perform SQL INSERT on ${body[107]}"/>
this doesnt work either. I get an error saying that the key 107 is not
valid.
Finally, in desperation I tried inserting a converter statement:
<convertBodyTo type="quickfix.Message"/>
but no change in behavior.
Can someone help with a little explanation?
Thanks,
Bill
org.springframework.dao.TransientDataAccessResourceException:
PreparedStatementCallback; SQL [insert into OMM.dbo.IOIs (id, IDSource,
IOIid, Symbol, IOIShares, SecurityDesc, Price, IOINatural) VALUES (2,
'BILLSOURCE', '0001', 'HOG', 12345, 'Harley Davidson', 32.00, 'Y')]; The
index 1 is out of range.; nested exception is
com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is out of
range.
at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:106)
at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:619)
at
org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:49)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:58)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:576)
at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:509)
at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:220)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
at
org.apache.camel.component.quickfixj.QuickfixjConsumer.onExchange(QuickfixjConsumer.java:38)
at
org.apache.camel.component.quickfixj.QuickfixjEndpoint.onEvent(QuickfixjEndpoint.java:94)
at
org.apache.camel.component.quickfixj.QuickfixjEngine$Dispatcher.dispatch(QuickfixjEngine.java:448)
at
org.apache.camel.component.quickfixj.QuickfixjEngine$Dispatcher.fromApp(QuickfixjEngine.java:385)
at quickfix.Session.fromCallback(Session.java:1698)
at quickfix.Session.verify(Session.java:1650)
at quickfix.Session.verify(Session.java:1727)
at quickfix.Session.next(Session.java:987)
at
quickfix.mina.SingleThreadedEventHandlingStrategy$SessionMessageEvent.processMessage(SingleThreadedEventHandlingStrategy.java:114)
at
quickfix.mina.SingleThreadedEventHandlingStrategy.block(SingleThreadedEventHandlingStrategy.java:77)
at
quickfix.mina.SingleThreadedEventHandlingStrategy$1.run(SingleThreadedEventHandlingStrategy.java:94)
at java.lang.Thread.run(Unknown Source)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is
out of range.
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setterGetParam(SQLServerPreparedStatement.java:714)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObjectNoType(SQLServerPreparedStatement.java:910)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:935)
at
org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:55)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)
... 83 more
--
View this message in context: http://camel.465427.n5.nabble.com/QuickfixJ-Message-Map-tp5738238.html
Sent from the Camel - Users mailing list archive at Nabble.com.