IChangeEventHandler::handleEvent called repeatedly...
I create the IChangeEvent and save it (once).
My registered event handler (handleEvent on IChangeEventHandler) gets called repeatedly for this event every time the change event task kicks in.
Question: is this intended? I would only like to be called once per instance of an event. Is there a way I can force this behavior by doing something in either the event creation or response to the event?
Thanks,
John
Accepted answer
IChangeEventService::delete(event)
If this is not the correct approach then please advise.
I have created an event/event handler pair (IChangeEvent / IChangeEventHandler).
I create the IChangeEvent and save it (once).
My registered event handler (handleEvent on IChangeEventHandler) gets called repeatedly for this event every time the change event task kicks in.
Question: is this intended? I would only like to be called once per instance of an event. Is there a way I can force this behavior by doing something in either the event creation or response to the event?
Thanks,
John
Comments
John,
Did you end up concluding that deleting the event was the correct approach to the question of repeating event handler calls? I am seeing the same kind of behavior in my add-snapshot event handler: the handler is called repeatedly, usually 7 times (from data I've captured so far). I have been looking for something that says "you need to do thus-and-such to signal that you are finished handling the event". It did not occur to me to delete the event; for all I know there may be other handlers that want to see the same event. Any advice?
Thanks,
Scott
Hi Scott,
If we're talking about com.ibm.team.process.service.IChangeEventHandler, the behavior described here sounds like a bug. You shouldn't have to delete your change events. Your handler should only be called for each event once.
One other answer
One idea I had was to let RTC handle scrubbing the event, by setting the ChangeEvent's expiration time to "now". However, that led to an ImmutablePropertyException (and indeed, event.isImmutable() returns true for the IChangeEvents I see when a snapshot is added to a stream). Some browsing on jazz.net suggests that I may need a "working copy". But again, I'm not finding the information I need to make sense out of these concepts of immutability, nor how to use working copies of various flavors.
Any suggestions or links would be highly appreciated.
And thanks again for your earlier response,
Scott