[rabbitmq-discuss] rabbitmq server to server communication
Alexis Richardson
alexis.richardson at gmail.com
Sun Jan 24 09:20:53 GMT 2010
Uwe
On Sun, Jan 24, 2010 at 12:42 AM, Uwe Kubosch <uwe at datek.no> 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.
That would be great. Running examples are helpful.
alexis
>> 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