[rabbitmq-discuss] Creating a job only once (using Java Client API)

Allan Kamau kamauallan at gmail.com
Mon Apr 18 17:13:43 BST 2011


On Mon, Apr 18, 2011 at 3:40 PM, Dave Syer <david_syer at hotmail.com> wrote:
>
>> This is the situation. I am developing a distributed application which
>> comprises of several instances of itself at runtime. A single instance
>> of this application would be mostly single threaded and have no
>> interprocess communication and can be viewed as a worker.
>
> I think you are looking for a global lock implementation, which Rabbit
> can never be.  Messaging is a good way to ensure that precisely one of
> your consumers acts on a given message, but there is no guarantee
> without a central lock that precisely one message will be sent.  Does
> that make sense, or did I misread the requirement?
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>

Almost. I am trying to process jobs level by level. Let's say I have a
tree structure, where I need to create jobs one level at a time and
completely process them then generate the next batch of jobs and
process them totally and so on. Each job (level) creation depends on
the successful processing of all the jobs of the preceding level as
those results form the bases of the jobs being created for the new
level.

So the key is for the client that obtained and successfully processed
the last job to realize this fact and generate the next round of jobs.
The jobs are to be generated and injected into the queue by a single
client, process and thread.

One way would be to specially mark the last job as it is being
generated in the job creation undertaking, then program the clients to
be on the lookout for this "last" job as they process the jobs. But
this may not really work well considering that some jobs may take
longer to process than this job marked as "last" and that they may be
some jobs still under processing or awaiting to be processed (if they
were resent due to some failure of some kind) after the completion of
processing of the "last" job.



Allan.


More information about the rabbitmq-discuss mailing list