Guest User

Untitled

a guest
Aug 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. # encoding: utf-8
  2.  
  3. require 'java'
  4. require 'ext/commons-io'
  5. require 'ext/rabbitmq-client'
  6.  
  7.  
  8. module HotBunnies
  9. import com.rabbitmq.client.ConnectionFactory
  10. import com.rabbitmq.client.Connection
  11. import com.rabbitmq.client.Channel
  12. import com.rabbitmq.client.DefaultConsumer
  13. import com.rabbitmq.client.QueueingConsumer
  14.  
  15. import com.rabbitmq.client.AMQP
  16.  
  17. CONNECTION_PROPERTIES = [:host, :port, :virtual_host, :connection_timeout, :username, :password]
  18.  
  19. def self.connect(options={})
  20. cf = ConnectionFactory.new
  21. CONNECTION_PROPERTIES.each do |property|
  22. if options[property]
  23. cf.send("#{property}=".to_sym, options[property])
  24. end
  25. end
  26. cf.new_connection
  27. end
  28. end
  29.  
  30. require 'hot_bunnies/channel'
  31. require 'hot_bunnies/queue'
  32. require 'hot_bunnies/exchange'
Add Comment
Please, Sign In to add comment