You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jana <ja...@conviator.com> on 2012/06/26 11:12:19 UTC

php/topic subscribe?

Hi
Im trying to get a small testsetup running where I need to post msg. to a
TOPIC from PHP and read them from java later. For now, to test, I simply use
php both on the producer and consumer side. 
Its based on http://stomp.fusesource.org/documentation/php/book.html
but its not really working. Its not a TOPIC but a queue thats being
made/used so if I have two clients consuming msg. then they only get every
2. msg. and looking at the admin it seams also that its transforming the
"/topic/test" into /queue/topic/test in reallity explaning why the consumers
only get every 2. not all of them as I would think is the expected thing
when using a topic. 
It seams topics are supposed to be working? So is it a issue with activemq
5.6 + fuse+php+stomp impl? Or just the fuse´php+stomp impl.? Anyone knows of
a impl. that works for sure (if its the fuse-impl. thats at fault)?
Or something completly different wrong? 
Best regards
Jan


--
View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by jana <ja...@conviator.com>.
hip hip hurraaa... :)

I took the 5.7 snapshot at that did it. It works - its a topic, I can see
the subscribers as durable in the admin and so on and ofcause a mesg. send
to the topic is getting to all clients I have running. 

Cool and thanks. Now we can start trying out our ideas. 

--
View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653589.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by Timothy Bish <ta...@gmail.com>.
On Tue, 2012-06-26 at 08:29 -0700, jana wrote: 
> per my post we have:
> 
> define('_MQ_TOPIC_SEARCH',      '/topic/mytopicname');
> 
> so unless its not supposed to work with implicit created topic we do have
> /topic/ in front. 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653585.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

You probably need to update your PHP client code with the latest in
GitHub as the older code was adding space padding in message headers
that was causing ActiveMQ v5.6.0 to not parse the destinations
correctly.  You can also use a later 5.7-SNAPSHOT build and it should
start working correctly with the older php client code. 


-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: php/topic subscribe?

Posted by jana <ja...@conviator.com>.
per my post we have:

define('_MQ_TOPIC_SEARCH',      '/topic/mytopicname');

so unless its not supposed to work with implicit created topic we do have
/topic/ in front. 

--
View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653585.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by Hiram Chirino <ch...@gmail.com>.
Prefix the topic name with /topic/

Sent from my iPhone

On Jun 26, 2012, at 5:45 AM, jana <ja...@conviator.com> wrote:

> I should add - thats the producer but this does not result in a topic on the
> MQ but rather a queue. From java if I ask for the queue "mytopicname" I get
> the msg. posted by the php code but if I ask for a topic with that name from
> java I dont get any msg. 
> 
> and again, two php consumers subscribing to this results in every 2. msg.
> going to one or the other so clear queue behaviour also.
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653567.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by jana <ja...@conviator.com>.
I should add - thats the producer but this does not result in a topic on the
MQ but rather a queue. From java if I ask for the queue "mytopicname" I get
the msg. posted by the php code but if I ask for a topic with that name from
java I dont get any msg. 

and again, two php consumers subscribing to this results in every 2. msg.
going to one or the other so clear queue behaviour also.

--
View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653567.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by jana <ja...@conviator.com>.
<?php
require_once('config.php');
$message = "search query";
$producer = new Stomp(_MQ_SERVER);
$producer->connect();
$producer->send(
        _MQ_TOPIC_SEARCH,
        $message,
        array('persistent'=>'true')
);
$producer->disconnect();
?>

<?php
date_default_timezone_set('UTC');

define('_MQ_SERVER',            'tcp://192.168.X.X:61613');
define('_MQ_CLIENT_ID',         'some uniq string');
define('_MQ_TOPIC_SEARCH',      '/topic/mytopicname');
define('_MQ_DATE_FORMAT',       'Y-m-d H:i');
define('_MQ_SLEEP',                     5);

require_once('Stomp.php');
?>


--
View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564p4653566.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: php/topic subscribe?

Posted by Dejan Bosanac <de...@nighttale.net>.
It'd be good if you can share your test code. Topics should be working
fine with PHP Stomp impl.

Regards
--
Dejan Bosanac
Senior Software Engineer | FuseSource Corp.
dejanb@fusesource.com | fusesource.com
skype: dejan.bosanac | twitter: @dejanb
blog: http://www.nighttale.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Tue, Jun 26, 2012 at 11:12 AM, jana <ja...@conviator.com> wrote:
> Hi
> Im trying to get a small testsetup running where I need to post msg. to a
> TOPIC from PHP and read them from java later. For now, to test, I simply use
> php both on the producer and consumer side.
> Its based on http://stomp.fusesource.org/documentation/php/book.html
> but its not really working. Its not a TOPIC but a queue thats being
> made/used so if I have two clients consuming msg. then they only get every
> 2. msg. and looking at the admin it seams also that its transforming the
> "/topic/test" into /queue/topic/test in reallity explaning why the consumers
> only get every 2. not all of them as I would think is the expected thing
> when using a topic.
> It seams topics are supposed to be working? So is it a issue with activemq
> 5.6 + fuse+php+stomp impl? Or just the fuse´php+stomp impl.? Anyone knows of
> a impl. that works for sure (if its the fuse-impl. thats at fault)?
> Or something completly different wrong?
> Best regards
> Jan
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/php-topic-subscribe-tp4653564.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.