AFAIR, the first parameter of Zend_Queue::receive() is $maxMessages - the
maximum number of messages to receive from queue.
Also, you can use do count() on messages to tell if there's any messages
available to process and exit if there isn't.

On Thu, Nov 26, 2009 at 12:15 PM, <[email protected]> wrote:

>  Hi,
>
> I would like to write a message consumer that can process a stream of
> messages, something like:
>
> foreach ($queue->recieve() as $message) {
>   $this->processor->processMessage($message);
> }
>
> I could do something like this:
>
> for ($continue = true; $continue; ) {
>   $continue = false;
>   foreach ($queue->recieve() as $message) {
>     $this->processor->processMessage($message);
>     $continue = true;
>   }
> }
>
> but this is really ugly and, if I'm using the Stomp client (as I will be),
> really inefficient.
>
> Ideally I'd like a special type of Stomp adapter and message iterator set
> that would subscribe and then continue recieving messages until there's
> nothing left. Any ideas on how to implement this with the current
> architecture or how I'd go about submitting something like this if it's not
> currently possible?
>
> Thanks
> Rob
>
> This E-mail is from IPC Media Ltd, a company registered in England and
> Wales, whose registered office is at Blue Fin Building, 110 Southwark
> Street, London, SE1 0SU, registered number 53626, VAT number 646150645. The
> contents and any attachments to it include information that is private and
> confidential and should only be read by those persons to whom they are
> addressed. IPC Media accepts no liability for any loss or damage suffered by
> any person arising from the use of this e-mail. Neither IPC Media nor the
> sender accepts any responsibility for viruses and it is your responsibility
> to check the email and attachments (if any). No contracts may be concluded
> on behalf of IPC Media by means of e-mail communications. If you have
> received this e-mail in error, please destroy and delete the message from
> your computer.
>  Huge savings on magazine subscriptions this Christmas. Find gift
> inspiration at http://www.magazinesdirect.com/xmasgifts
>
>  Please consider the environment - only print this e-mail if absolutely
> necessary
>

Reply via email to