Last active
August 29, 2015 13:56
-
-
Save tristanperalta/9168118 to your computer and use it in GitHub Desktop.
Bitcoin Publisher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
require 'amqp' | |
require 'bitcoin-client' | |
txn_id = ARGS[0] | |
client = Bitcoin::Client.new(blah) | |
wallet_address = client.get_wallet_address(txn_id) | |
EM.run do | |
AMQP.connect(host: 'localhost') do |connection| | |
channel = connection.channel | |
exchange = channel.fanout | |
exchange.publish("bitcoin.#{wallet_address}") | |
# close EventMachine connection here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment