Message always publish to localhost. Reuse base 'channel' method to publ... #14

Merged
merged 1 commit into from Jul 23, 2012

Conversation

Projects
None yet
4 participants
@pavel-drobushevich
Contributor

pavel-drobushevich commented Jul 18, 2012

...ish and subscribe on one instance (via change connection host to not localhost).

Message always publish to localhost. Reuse base 'channel' method to p…
…ublish and subscribe on one instance (via change connection host to not localhost).
@majek

This comment has been minimized.

Show comment Hide comment
@majek

majek Jul 23, 2012

Contributor

I'm not a ruby person. What's the difference?

Contributor

majek commented Jul 23, 2012

I'm not a ruby person. What's the difference?

@pavel-drobushevich

This comment has been minimized.

Show comment Hide comment
@pavel-drobushevich

pavel-drobushevich Jul 23, 2012

Contributor

Old code call following method:
AMQP::Exchange.default
Source code for this method:
https://github.com/ruby-amqp/amqp/blob/master/lib/amqp/exchange.rb (line 149 and below)
This method has one argument - channel to connect, If this argument is not provided exchange creates default channel which connects to localhost. It is not expected, because FibonacciRpcClient has own channel and in my case it was configured to remote RabbitMQ installation, but as result message try to send to default localhost channel (I don't have local instance).
There are two possible:

  1. Use exist channel to create exchange
    self.channel.default_exchange
  2. Send exist channel to this method
    AMQP::Exchange.default(self.channel)
Contributor

pavel-drobushevich commented Jul 23, 2012

Old code call following method:
AMQP::Exchange.default
Source code for this method:
https://github.com/ruby-amqp/amqp/blob/master/lib/amqp/exchange.rb (line 149 and below)
This method has one argument - channel to connect, If this argument is not provided exchange creates default channel which connects to localhost. It is not expected, because FibonacciRpcClient has own channel and in my case it was configured to remote RabbitMQ installation, but as result message try to send to default localhost channel (I don't have local instance).
There are two possible:

  1. Use exist channel to create exchange
    self.channel.default_exchange
  2. Send exist channel to this method
    AMQP::Exchange.default(self.channel)
@michaelklishin

This comment has been minimized.

Show comment Hide comment
@michaelklishin

michaelklishin Jul 23, 2012

Owner

The idea is to not allocate a new channel implicitly. In practical terms, it makes no difference for tutorials but may lead to people doing this unknowingly in real world code, over and over.

Owner

michaelklishin commented Jul 23, 2012

The idea is to not allocate a new channel implicitly. In practical terms, it makes no difference for tutorials but may lead to people doing this unknowingly in real world code, over and over.

majek added a commit that referenced this pull request Jul 23, 2012

Merge pull request #14 from pavel-drobushevich/patch-1
Message always publish to localhost. Reuse base 'channel' method to publ...

@majek majek merged commit 248e69f into rabbitmq:master Jul 23, 2012

@dumbbell dumbbell added this to the n/a milestone Mar 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment