Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'amqp'
- require 'json'
- require 'bert'
- AMQP.start(:logging=>true,:host=>"127.0.0.1",:port=>5672,:user=>"es_writer",:pass=> "foo",:vhost=> "/elasticsearch",:ssl=> false) do |connection|
- ch = AMQP::Channel.new(connection)
- ex = ch.topic("es")
- payload = BERT.encode({:optimizer_id=>1}.to_json)
- ex.publish(payload,:routing_key => "es.optimizer.index")
- #AMQP.stop {EM.stop}
- connection.close { puts "Closed ok" ; EM.stop }
- end
Add Comment
Please, Sign In to add comment