Class: BrmClient::Gateway::Stomp
- Inherits:
-
Object
- Object
- BrmClient::Gateway::Stomp
- Defined in:
- lib/brm_client/gateway/stomp.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(opts) ⇒ Stomp
constructor
A new instance of Stomp.
- #send_event(e) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Stomp
Returns a new instance of Stomp.
8 9 10 11 12 13 |
# File 'lib/brm_client/gateway/stomp.rb', line 8 def initialize opts hosts = opts[:hosts] || [ opts[:host] ] hosts.map! &:to_options @client = ::Stomp::Client.new({ :hosts => hosts }) @queue = "/queue/#{opts[:application]}" end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/brm_client/gateway/stomp.rb', line 6 def client @client end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
6 7 8 |
# File 'lib/brm_client/gateway/stomp.rb', line 6 def queue @queue end |
Instance Method Details
#disconnect ⇒ Object
15 16 |
# File 'lib/brm_client/gateway/stomp.rb', line 15 def disconnect end |
#send_event(e) ⇒ Object
18 19 20 |
# File 'lib/brm_client/gateway/stomp.rb', line 18 def send_event e @client.publish(@queue, e.to_json) end |