mercredi 1 juillet 2015

Polling a Queue Forever & Processing Messages

I have some code that polls an AWS Queue forever, waiting for messages to show up in the queue, and when messages are received, the program processes the message body. Right now, I'm using a scheduled executor service and it executes a Runnable that does all the processing in the run() method. I would like to use a callable instead and return the results to be processed in other methods, but I'm not sure if this is possible. Do I have to wrap the entire program (main method, essentially) inside an infinite loop to do my processing, or is there a way to run an infinite loop to receive messages that returns the message body to be processed by other methods?




Aucun commentaire:

Enregistrer un commentaire