« Return to Thread: Stomp Problem with receiving topic

Re: Stomp Problem with receiving topic

by Plew :: Rate this Message:

Reply to Author | View in Thread

Thank you Roger

the problem is, that I have more describer for one topic, and they want to get all unread messages when they "log in" at the server....


Roger Hoover wrote:
I think that's the way topics are supposed to work.  As far as I know, you
have to be subscribed to the topic in order to get messages that were
published to it.  You would need to implement a PHP daemon that remains
subscribed to the topic.

If you want to pick up messages periodically and you only have one consumer
for each message, you can use a queue.

HTH,

Roger

On Fri, Jun 26, 2009 at 9:29 AM, Plew <plew@gmx.de> wrote:

>
> Hi
>
> i've got a problem with Stomp+PHP 5+ActiveMQ 5.2, I'm new to MQ and JMS,
> hope you can help me.
>
> I want to output all messages from a subscribed topic with PHP. The problem
> is, only the last message wich was sent by an client to the topic is shown
> by the subscriber, but I want to receive also the old messages from the
> topic and not only the last one. Also the PHP-Script is not working, when
> the topic stores old messages, nothing is shown - it's only working when
> it's listening and the client send something new to the topic???
>
> I tried this sheet of code for the Subscriber (for sending i used the
> ApacheMQ-Bin Webfrontend).
>
> <?php
> require_once("Stomp.php");
> $con = new Stomp("tcp://192.0.0.101:61613");
> $con->connect();
> $con->subscribe("/topic/test");
> $msg = $con->readFrame();
> echo $msg->body."\n";
> $con->ack($msg);
> $con->disconnect();
> ?>
>
>
> So what should i do, to get all the unreceived messages from the topic,
> which where send between last subscription an now, without polling all the
> time with one script and a neverending loop, i want to poll  cyclic with a
> script, to get one or more messages from the topic???
>
> greetings
> Stefan
> --
> View this message in context:
> http://www.nabble.com/Stomp-Problem-with-receiving-topic-tp24223394p24223394.html
> Sent from the stomp - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

 « Return to Thread: Stomp Problem with receiving topic