Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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
Contributor

pavel-drobushevich commented Jul 18, 2012

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

@pavel-drobushevich pavel-drobushevich Message always publish to localhost. Reuse base 'channel' method to p…
…ublish and subscribe on one instance (via change connection host to not localhost).
961b21b
Contributor

majek commented Jul 23, 2012

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

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)
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 majek added a commit that referenced this pull request Jul 23, 2012

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

@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