camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@evosent.com>
Subject Re: Some Stupid Questions
Date Mon, 03 Aug 2015 08:18:03 GMT
On 2 Aug 2015 13:05, "Felix Thomas" <felix.thomas@gmail.com> wrote:

>  2) Threading :- If I have declared a Bean as above and if I use it in a
> SPLIT in Parallel processing mode using a Thread profile. Will Camel also
> create a Pool of the bean and pass it for each thread. i.e. if my Pool
size
> is 5 will  camel create 5 instance of the bean class and use it in the
> processing automatically.  I want to know if it will be thread safe for
> each bean object.

Camel will not build the bean, but it will request it to the registry. So
it's up to the registry to return a new instance or a singleton. In Spring,
you can configure this with the 'scope' attribute.

I suggest you give it a spin with printlns so you can understand when the
new instances are created.

By default, all registries (Spring, Blueprint, Simple Java) return
singletons.

>
> 3) Database component :-  If i am getting billions of data from a DB using
> a timer component consumer is there any feature that I can mark some
column
> with some flag stating it has been processed .
>
> I saw in the SQL Component there are some option like consumer.onConsume
> etc. but is there something similar in JDBC component .  Other approach is
> to move some records to a temporary table and use that but still some flag
> has to be done on the Original table which is being updated every moment.

I suggest you add a WHERE condition to filter out records that do not have
this flag, and use an onCompletion with onCompleteOnly, in sync mode and
BeforeConsumer, in order to set the flag on the record(s) before the route
is done processing.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message