-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help with Listener Pattern
PostPosted: Tue Jun 26, 2007 1:34 pm 
Newbie

Joined: Tue Jun 26, 2007 1:10 pm
Posts: 1
Wondering how other people have solved this issue. Let's take the Item/Bid example from the HIA book.
Let's say we want to add a new feature to the system:
1. bidders are automatically notified when the item description is updated.
2. bidders can automatically withdraw their bid when the description is updated.

One way to solve this is to use the Interceptor to listen for updates on Bid. In the callback, we retrieve the collection of items bid for by the bidder and delete the item from that collection. However, this potentially involves lazy loading of collections which is forbidden in the Interceptor callback.

Likewise, one can foresee more and more features that depend on monitoring changes to an item (fraud detection feature, statistics...)

I believe that most domain models will have a few very "busy" objects which everyone (and more) want to monitor for updates / deletions/creations. But the Interceptor callback severely constrains what can be done. Likewise, I think the Event callback is similarly unsuited.

I can think of a couple of solutions:
1. Use the Interceptor callback to queue up change notifications to listeners in a separate thread (fire and forget). this way the callback is only doing one thing and doing it well
2. Build a separate publish / subscribe framework which the service layer must publish to before C/U/D on Item. this is error-prone because people will just forget to do this
3. Anything else?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.