sql - Is Apache Camel's idempotent consumer pattern scalable? -
i'm using apache camel 2.13.1 poll database table have upwards of 300k rows in it. i'm looking use idempotent consumer eip filter rows have been processed.
i'm wondering though, whether implementation scalable or not. camel context is:-
<camelcontext xmlns="http://camel.apache.org/schema/spring"> <route id="main"> <from uri="sql:select * transactions?datasource=mydatasource&consumer.delay=10000&consumer.useiterator=true" /> <transacted ref="propagation_required" /> <enrich uri="direct:invokeidempotenttransactions" /> <!-- processors here executed on messages --> </route> <route id="idempotenttransactions"> <from uri="direct:invokeidempotenttransactions" /> <idempotentconsumer messageidrepositoryref="jdbcidempotentrepository"> <ognl>#{request.body.id}</ognl> <!-- here executed non-duplicates --> <log message="non-duplicate" /> <to uri="stream:out" /> </idempotentconsumer> </route> </camelcontext>
it seem full 300k rows going processed every 10 seconds (via consumer.delay parameter) seems inefficient. expect sort of feedback loop part of pattern query feeds filter take advantage of set of rows processed.
however, messageid column in camel_messageprocessed table has pattern of
{1908988=null}
where 1908988 request.body.id i've set eip key on doesn't make easy incorporate query.
is there better way of using camel_messageprocessed table feedback loop select statement sql server performing of load?
update:
so, i've since found out ognl code causing odd message id column value. changing to
<el>${in.body.id}</el>
has fixed it. so, have usable messageid column, can change 'from' sql query to
select * transactions tr tr.id in (select cmp.messageid camel_messageprocessed cmp cmp.processor = 'transactionprocessor')
but still think i'm corrupting idempotent consumer eip.
does else this? reason not to?
yes, is. need use scalable storage holding sets of processed messages. can use either hazelcast - http://camel.apache.org/hazelcast-idempotent-repository-tutorial.html or infinispan - http://java.dzone.com/articles/clustered-idempotent-consumer - depending on solution in stack. of course, jdbc repository work, if meets performance criteria selected.
Comments
Post a Comment