Hi,

you don't need to use hasFrameToRead() explicitly, it is used from
readFrame().

So you can do something like,

while ($msg = $con->readFrame()) {

  // do you stuff

}

BTW. Be sure to check PHP Stomp Client 1.0.0 released here
http://stomp.fusesource.org/documentation/php/index.html

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Wed, Nov 11, 2009 at 10:15 PM, jwotman <jwot...@hotmail.com> wrote:

>
> I'm using PHP STOMP to read messages from activemq.  I am able to read one
> message and then hasFrameToRead will always return false.  I switched to
> Java to get the project out the door but want to solve this issue because
> we'll want to talk to activemq from multiple languages.  I'm using version
> 5.3.  Here's the basic code:
>
> public function getMessages(){
>
>                $con = new Stomp(MESSAGING_BROKER_URL);
>                $con ->connect('system','manager');
>                $con->subscribe(MESSAGING_QUEUE_NAME);
>
>
>                $messages = array();
>                while($con->hasFrameToRead()){
>
>                        $message = $con->readFrame();
>                        $body = $message ->body;
>                        $headers = $message ->headers;
>                        $messageId = $headers['message-id'];
>                        $messages[$messageId] = $body;
>
>
>                }
>
>                $con ->disconnect();
>                return $messages;
>
>
>        }
>
> --
> View this message in context:
> http://old.nabble.com/hasFrameToRead-always-returns-false-after-first-message-tp26308746p26308746.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to