Class: BrmClient::Gateway::Stomp

Inherits:
Object
  • Object
show all
Defined in:
lib/brm_client/gateway/stomp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/brm_client/gateway/stomp.rb', line 6

def client
  @client
end

#queueObject (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

#disconnectObject



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