Stomp Problem with receiving topic

View: New views
5 Messages — Rating Filter:   Alert me  

Stomp Problem with receiving topic

by Plew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Stomp Problem with receiving topic

by Roger Hoover :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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




Re: Stomp Problem with receiving topic

by Plew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>
>
>

Re: Stomp Problem with receiving topic

by Roger Hoover :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Based on your description of the problem, it sounds to me like a messaging product is not a good fit for your requirements.  Some kind of RSS or Atom server would be well suited.  Producers can publish to the Atom/RSS feed and consumers can get new items for them every time they "log in".


On Fri, Jun 26, 2009 at 10:58 PM, Plew <plew@...> wrote:

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@...> 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
>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Stomp-Problem-with-receiving-topic-tp24223394p24230672.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




Re: Stomp Problem with receiving topic

by Dejan Bosanac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

what you need is durable subscriber for the topic.

Unfortunately, the best description is here

http://www.nabble.com/stomp-durable-subscriber-td19446909.html

should write a doc for it.

Cheers
--
Dejan Bosanac

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


On Sat, Jun 27, 2009 at 7:58 AM, Plew <plew@...> wrote:

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@...> 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
>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Stomp-Problem-with-receiving-topic-tp24223394p24230672.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



Dejan Bosanac

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