You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Alex_ynr <su...@gmail.com> on 2007/05/14 22:29:21 UTC

PollinComponentSupport Persistence

This might be a silly question but here it goes. Apologies if it's something
quite simple....

I'm using a DB polling class that extends PollingComponent support.

It's nothing fancy, it just sends an <sql>...</sql> message to the JDBC
component every few seconds....

Upon initialization the query is sth like "SELECT * FROM... WHERE
timestamp=0;

Then timestamp is set to the current timestamp and a few seconds later a new
query is sent with timestamp= the previous timestamp...

The results of the queries are published to JMS using JDBC component. Since
i can persist those results in JMS, how can I persist teh state of the
Polling component (i.e. the timestamp) so if there is a failure it picks up
where it left off?
-- 
View this message in context: http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10611452
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: PollinComponentSupport Persistence

Posted by Guillaume Nodet <gn...@gmail.com>.
I would rather use a file to store the latest timestamp.
Using JMS in this case is not very ideal imho...

On 5/15/07, Alex_ynr <su...@gmail.com> wrote:
>
>
> Ideally, I want to keep the whole system "invisible" to the database...
> i.e.
> not have to mark rows etc.
>
> One thought I had (I'm pretty much a newbie in JBI/Servicemix so bear with
> me if some of my ideas are very silly) is to use the JDBCcomponent to
> publish the key in a separate topic/queue.
>
> For example, JDBCcomponent receives query, publishes result to the queue
> just as it does now and also publishes the latest key/index to a separate
> topic for this purpose.
>
> Then set up my polling component to receive messages from this topic (ie
> the
> one message with the key)  and set up a couple of variables (some kind of
> initialisation) .. Then implement poll() in such a way as to use those...
>
> Any thoughts?
>
>
>
>
> gnodet wrote:
> >
> > What about marking the column when the jms message has been succesfully
> > send
> > ?
> > I.e. when receiving the DONE status.   This could lead to duplicate of
> > course.
> > The other way would be to use XA transaction (and still mark the rows as
> > processed).
> >
> > Or you could store the timestamp in your DB if you carefuly control the
> > threading of the component.
> >
> > On 5/14/07, Alex_ynr <su...@gmail.com> wrote:
> >>
> >>
> >> This might be a silly question but here it goes. Apologies if it's
> >> something
> >> quite simple....
> >>
> >> I'm using a DB polling class that extends PollingComponent support.
> >>
> >> It's nothing fancy, it just sends an <sql>...</sql> message to the JDBC
> >> component every few seconds....
> >>
> >> Upon initialization the query is sth like "SELECT * FROM... WHERE
> >> timestamp=0;
> >>
> >> Then timestamp is set to the current timestamp and a few seconds later
> a
> >> new
> >> query is sent with timestamp= the previous timestamp...
> >>
> >> The results of the queries are published to JMS using JDBC component.
> >> Since
> >> i can persist those results in JMS, how can I persist teh state of the
> >> Polling component (i.e. the timestamp) so if there is a failure it
> picks
> >> up
> >> where it left off?
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10611452
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Principal Engineer, IONA
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10619696
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: PollinComponentSupport Persistence

Posted by Alex_ynr <su...@gmail.com>.
Ideally, I want to keep the whole system "invisible" to the database... i.e.
not have to mark rows etc.

One thought I had (I'm pretty much a newbie in JBI/Servicemix so bear with
me if some of my ideas are very silly) is to use the JDBCcomponent to
publish the key in a separate topic/queue.

For example, JDBCcomponent receives query, publishes result to the queue
just as it does now and also publishes the latest key/index to a separate
topic for this purpose.

Then set up my polling component to receive messages from this topic (ie the
one message with the key)  and set up a couple of variables (some kind of
initialisation) .. Then implement poll() in such a way as to use those...

Any thoughts?




gnodet wrote:
> 
> What about marking the column when the jms message has been succesfully
> send
> ?
> I.e. when receiving the DONE status.   This could lead to duplicate of
> course.
> The other way would be to use XA transaction (and still mark the rows as
> processed).
> 
> Or you could store the timestamp in your DB if you carefuly control the
> threading of the component.
> 
> On 5/14/07, Alex_ynr <su...@gmail.com> wrote:
>>
>>
>> This might be a silly question but here it goes. Apologies if it's
>> something
>> quite simple....
>>
>> I'm using a DB polling class that extends PollingComponent support.
>>
>> It's nothing fancy, it just sends an <sql>...</sql> message to the JDBC
>> component every few seconds....
>>
>> Upon initialization the query is sth like "SELECT * FROM... WHERE
>> timestamp=0;
>>
>> Then timestamp is set to the current timestamp and a few seconds later a
>> new
>> query is sent with timestamp= the previous timestamp...
>>
>> The results of the queries are published to JMS using JDBC component.
>> Since
>> i can persist those results in JMS, how can I persist teh state of the
>> Polling component (i.e. the timestamp) so if there is a failure it picks
>> up
>> where it left off?
>> --
>> View this message in context:
>> http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10611452
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Principal Engineer, IONA
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10619696
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: PollinComponentSupport Persistence

Posted by Guillaume Nodet <gn...@gmail.com>.
What about marking the column when the jms message has been succesfully send
?
I.e. when receiving the DONE status.   This could lead to duplicate of
course.
The other way would be to use XA transaction (and still mark the rows as
processed).

Or you could store the timestamp in your DB if you carefuly control the
threading of the component.

On 5/14/07, Alex_ynr <su...@gmail.com> wrote:
>
>
> This might be a silly question but here it goes. Apologies if it's
> something
> quite simple....
>
> I'm using a DB polling class that extends PollingComponent support.
>
> It's nothing fancy, it just sends an <sql>...</sql> message to the JDBC
> component every few seconds....
>
> Upon initialization the query is sth like "SELECT * FROM... WHERE
> timestamp=0;
>
> Then timestamp is set to the current timestamp and a few seconds later a
> new
> query is sent with timestamp= the previous timestamp...
>
> The results of the queries are published to JMS using JDBC component.
> Since
> i can persist those results in JMS, how can I persist teh state of the
> Polling component (i.e. the timestamp) so if there is a failure it picks
> up
> where it left off?
> --
> View this message in context:
> http://www.nabble.com/PollinComponentSupport-Persistence-tf3754701s12049.html#a10611452
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/