[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Question on pausing the update method long enough to process messages...



Kelli,

I'm not sure if I got your problem right.

Do you want some store and forward queue which will be filled by the
update method?


Heinrich


On Wed, 27 Nov 2002, Kelli Fuller wrote:

> I am trying to learn how to use xmlBlaster. With that, I have written a
> pretty basic class to subscribe to and publish messages. In this class, I
> only subscribe to messages once and I only have one update() method,
> however in that method I take the content of the message, covert it to a
> xml DOM, edit some node values then I republish the message with a new key
> and erase the original message then finally create a xml file to store in a
> directory for another system to pick up. This class is on a scheduler that
> runs every 2 mintues.
>
> Currently, I am forcing a sleep period right after the code that subscribes
> of 3 secs per message, like this:
>
> if(updateCnt > 0)
> {
>       SubscribeKeyWrapper sk = new SubscribeKeyWrapper(sSubscribeKey,
> Constants.XPATH);
>       SubscribeQosWrapper sq = new SubscribeQosWrapper();
>       SubscribeRetQos subRet = con.subscribe(sk.toXml(), sq.toXml());
>
>       // Wait 3 secs for each message to ensure the update method has time
>       // to complete...
>       for(int ii=0; ii<updateCnt; ii++)
>       {
>             try { Thread.currentThread().sleep(3000); }
>             catch(InterruptedException i) {}
>       }
> }
>
> I have to do this to prevent the code below this from being executed. This
> is not a viable solution though because of the number of messages that
> could be in the queue at any given time.
>
> How can I ensure that all messages I've subscribed to run through the
> update method before continuring with any other processing? I've read about
> setting the burstMode.collectTime as an argument, which I've tried, but
> this didn't seem to solve my problem.
>
> I also need to ensure that for the current call to my class, that the
> update method doesn't get called by xmlBlaster when new messages are
> published. I want the next call to my class to get any new published
> messages and so on. So in other words, I want to subscribe to one set of
> messages, call update for only that set of messages given enough time to
> process as described above and stop and wait 2 minutes for this class to be
> called again and repeat.
>
> How can I control this?
>
> Thanks so much,
>
> Kelli
>