[rabbitmq-discuss] rabbitmq server to server communication
Uwe Kubosch
uwe at datek.no
Sun Jan 24 00:42:38 GMT 2010
On Jan 13, 2010, at 1:48 PM, Pradeep Gatram wrote:
We have made a similar "bridge" component in our project, with the only addition being the use of transactions, delivery confirmations, and acknowledgements for reliable delivery of the messages. I will post a gist if there is interest.
> Here is a quick n dirty amqp replicator that we've been using for a while. Modified it a bit to remove some project specific stuff. You may use it while you wait for the new release.
>
> Ruby code:
>
> require 'rubygems'
> require 'mq'
>
> EM.run do
> def replicate source, destination, topic
> source_q = MQ::Queue.new(source, "replicator for #{topic}")
> source_q.bind(MQ::Exchange.new(source, :topic, topic))
> destination_ex = MQ::Exchange.new(destination, :topic, topic)
>
> source_q.subscribe do |headers, msg|
> destination_ex.publish(msg)
> end
> end
>
> local, remote = %w{one two}, %w{three}
> localhost, remotehost = 'localhost', '192.168.0.26'
>
> local_channel = MQ.new(AMQP.connect(:host => localhost, :logging => false))
> remote_channel = MQ.new(AMQP.connect(:host => remotehost, :logging => false))
>
> local.each { |t| replicate local_channel, remote_channel, t }
> remote.each { |t| replicate remote_channel, local_channel, t }
> end
>
>
> Regards,
> Pradeep
>
>
--
Uwe Kubosch
Systems Developer
Datek Wireless AS
uwe at datek.no
http://datek.no/
More information about the rabbitmq-discuss
mailing list