Firstly, providing a chunk size breaks the idea of streaming messages. I want it to process each message as it comes not wait until there are x number of messages before returning them in bulk. Also, count is not supported by ActiveMQ (and besides, it's a broken concept with messaging, you should not be concerned with the size of the queue, merely whether there's anything to recieve or not.)
________________________________ From: George Miroshnikov [mailto:[email protected]] Sent: 29 November 2009 19:08 To: Young, Rob - IPC Digital <[email protected]> Cc: [email protected] Subject: Re: [fw-general] Zend_Queue streaming messages 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 <http://www.magazinesdirect.com/xmasgifts> Please consider the environment - only print this e-mail if absolutely necessary ----------------------------------------------------------------------- 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
