Producer/consumer in Grails?
Posted
by Mulone
on Stack Overflow
See other posts from Stack Overflow
or by Mulone
Published on 2010-05-25T14:28:38Z
Indexed on
2010/05/25
14:31 UTC
Read the original article
Hit count: 402
Hi all, I'm trying to implement a Consumer/Producer app in Grails, after several unsuccessful attempts at implementing concurrent threads. Basically I want to store all the events coming from a clients (through separate AJAX calls) in a single queue and then process such a queue in a linear way as soon as new events are added.
This looks like a Producer/Consumer problem: http://en.wikipedia.org/wiki/Producer-consumer_problem
How can I implement this in Grails (maybe with a timer or even better by generating an event 'process queue')?
Basically I'd like to a have a singleton service waiting for new events in the queue and processing them linearly (even if the queue is loaded by several concurrent processes).
Any hints?
Cheers!
© Stack Overflow or respective owner