Using Topics from PHP over Stomp

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

Using Topics from PHP over Stomp

by rob_young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to use Topics from PHP over Stomp. I can create a topic and a
durable subscriber through the web interface and my PHP consumer can
receive messages if it's connected to the topic when the message is
added. However, if a message is added to the topic when the consumer
isn't connected it never gets sent to it. This is not the behaviour I
was expecting. Basically, I am going to have multiple consumers all of
which need all the messages. They will be running periodically and
should receive all the messages sent to the topic since they last ran.
Any ideas?

require_once "Stomp.php";

$stomp = new Stomp('tcp://127.0.0.1:61613');
$stomp->clientId = 'test-client';
if ($stomp->connect()) {
  if ($stomp->subscribe('/topic/test.topic')) {
    $frame = $stomp->readFrame();
    if ($frame) {
      $stomp->ack($frame);
    }
  }
  $stomp->disconnect();
}

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


Re: Using Topics from PHP over Stomp

by Dejan Bosanac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rob,

you have to send durable messages in order to make this work.

Take a look at here
http://stomp.fusesource.org/documentation/php/book.html#_durable_subscribersfor
more info.
Also, you can take a look at examples/durable.php in PHP Stomp Client 1.0.0

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 Mon, Nov 2, 2009 at 5:36 PM, <rob_young@...> wrote:

> I'm trying to use Topics from PHP over Stomp. I can create a topic and a
> durable subscriber through the web interface and my PHP consumer can
> receive messages if it's connected to the topic when the message is
> added. However, if a message is added to the topic when the consumer
> isn't connected it never gets sent to it. This is not the behaviour I
> was expecting. Basically, I am going to have multiple consumers all of
> which need all the messages. They will be running periodically and
> should receive all the messages sent to the topic since they last ran.
> Any ideas?
>
> require_once "Stomp.php";
>
> $stomp = new Stomp('tcp://127.0.0.1:61613');
> $stomp->clientId = 'test-client';
> if ($stomp->connect()) {
>  if ($stomp->subscribe('/topic/test.topic')) {
>    $frame = $stomp->readFrame();
>    if ($frame) {
>      $stomp->ack($frame);
>    }
>  }
>  $stomp->disconnect();
> }
>
> 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
>
>
Dejan Bosanac

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

RE: Using Topics from PHP over Stomp

by rob_young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That was it, thank you Dejan.

-----Original Message-----
From: chubrilo@... [mailto:chubrilo@...] On Behalf Of Dejan
Bosanac
Sent: 02 November 2009 16:42
To: users@...
Subject: Re: Using Topics from PHP over Stomp

Hi Rob,

you have to send durable messages in order to make this work.

Take a look at here
http://stomp.fusesource.org/documentation/php/book.html#_durable_subscri
bersfor
more info.
Also, you can take a look at examples/durable.php in PHP Stomp Client
1.0.0

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 Mon, Nov 2, 2009 at 5:36 PM, <rob_young@...> wrote:

> I'm trying to use Topics from PHP over Stomp. I can create a topic and
a

> durable subscriber through the web interface and my PHP consumer can
> receive messages if it's connected to the topic when the message is
> added. However, if a message is added to the topic when the consumer
> isn't connected it never gets sent to it. This is not the behaviour I
> was expecting. Basically, I am going to have multiple consumers all of
> which need all the messages. They will be running periodically and
> should receive all the messages sent to the topic since they last ran.
> Any ideas?
>
> require_once "Stomp.php";
>
> $stomp = new Stomp('tcp://127.0.0.1:61613');
> $stomp->clientId = 'test-client';
> if ($stomp->connect()) {
>  if ($stomp->subscribe('/topic/test.topic')) {
>    $frame = $stomp->readFrame();
>    if ($frame) {
>      $stomp->ack($frame);
>    }
>  }
>  $stomp->disconnect();
> }
>
> 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
>
>