[rabbitmq-discuss] php talking to ruby

Robin Wood robin at digininja.org
Wed Jan 19 14:10:48 GMT 2011


On 19 January 2011 13:39, Michael Klishin <michael.s.klishin at gmail.com> wrote:
> Robin,
> What happens here two of your apps declare queue with different attributes
> because default values for
> parameters like durability seems to differ between that php library and what
> amqp gem uses.

I was hoping that that was the problem rather than a bug in my code.

> Since you only want to consume messages on the Ruby side and publish them on
> the PHP side, you
> have an option of only declaring one queue in your Ruby app and one exchange
> in the PHP app. Then you
> can use default exchange that routes messages to queues when routing key
> matches queue name.
> When queue is declared only in one place, differences in library defaults
> won't get in the way. And, default exchange
> was added to AMQP spec exactly for simple
> cases like yours. This scenario is
> described at http://www.rabbitmq.com/tutorial-one-python.html.
> Hope this helps.

I've had a look at the tutorial and from my original code I've removed
the exchange line from the Ruby consumer script which I assume means
it will go to the default one and changed the php exchange declare
line to:

$ex->declare('');

but when I run it I get

PHP Fatal error:  Uncaught exception 'AMQPExchangeException' with
message 'Server channel error: 403, message: ACCESS_REFUSED -
operation not permitted on the default exchange' in
/home/robin/comms/a.php:9
Stack trace:
#0 /home/robin/comms/a.php(9): AMQPExchange->declare('')
#1 {main}
  thrown in /home/robin/comms/a.php on line 9

If I change the empty string to default then I get the same
PRECONDITION_FAILED as before. I've not added any authentication
anywhere.

I want this to be able to work both directions, php tell Ruby to do
something then Ruby tell php when it is finished through a different
message. Will this work with this setup once I get the actual code
working?

Robin

>
> 2011/1/19 Robin Wood <robin at digininja.org>
>>
>> When I run the php I get:
>>
>> PHP Fatal error:  Uncaught exception 'AMQPQueueException' with message
>> 'Server channel error: 406, message: PRECONDITION_FAILED - parameters
>> for queue 'queue1' in vhost '/' not equivalent' in
>> /home/robin/sched/a.php:13
>> Stack trace:
>> #0 /home/robin/sched/a.php(13): AMQPQueue->declare('queue1')
>> #1 {main}
>>  thrown in /home/robin/sched/a.php on line 13
>>
>
> --
> MK


More information about the rabbitmq-discuss mailing list