Guest User

Untitled

a guest
Oct 19th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. require 'amqp'
  2. require 'json'
  3. require 'bert'
  4. AMQP.start(:logging=>true,:host=>"127.0.0.1",:port=>5672,:user=>"es_writer",:pass=> "foo",:vhost=> "/elasticsearch",:ssl=> false) do |connection|
  5. ch = AMQP::Channel.new(connection)
  6. ex = ch.topic("es")
  7. payload = BERT.encode({:optimizer_id=>1}.to_json)
  8. ex.publish(payload,:routing_key => "es.optimizer.index")
  9.  
  10. #AMQP.stop {EM.stop}
  11. connection.close { puts "Closed ok" ; EM.stop }
  12. end
Add Comment
Please, Sign In to add comment