Class: OnsOnRails::Publishers::Tcp

Inherits:
Object
  • Object
show all
Defined in:
lib/ons_on_rails/publishers/tcp.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Tcp

Returns a new instance of Tcp.


4
5
6
7
# File 'lib/ons_on_rails/publishers/tcp.rb', line 4

def initialize(options)
  @client = Ons::Producer.new(options.fetch(:access_key), options.fetch(:secret_key), options.fetch(:producer_id))
  @client.start
end

Instance Method Details

#publish(topic, tag, body, key) ⇒ Object


9
10
11
# File 'lib/ons_on_rails/publishers/tcp.rb', line 9

def publish(topic, tag, body, key)
  @client.send_message(topic, tag, body, key)
end