class RBKubeMQ::Streamer

Attributes

channel[R]
client_id[R]
meta[R]
store[R]

Public Class Methods

new(client:, client_id: nil, channel: nil, meta: nil, store: false) click to toggle source
Calls superclass method
# File lib/streamer.rb, line 5
def initialize(client:, client_id: nil, channel: nil, meta: nil, store: false)
  is_class?(client, [RBKubeMQ::Client], "client")
  @client = client
  @client_id  = client_id
  @channel = channel
  @meta    = meta.nil? ? meta.to_s : meta
  @store = store
  super("#{@client.ws}/send/stream")
end

Public Instance Methods

send(message, meta: @meta, store: @store, client_id: @client_id, channel: @channel, id: nil) click to toggle source
Calls superclass method
# File lib/streamer.rb, line 17
def send(message, meta: @meta, store: @store, client_id: @client_id,
    channel: @channel, id: nil)
  body = {
    "EventID" => id,
    "ClientID" => client_id,
    "Channel" => channel,
    "Metadata" => meta,
    "Body" => message,
    "Store" => store
  }
  super(RBKubeMQ::Utility.dump(body))
rescue StandardError => e
  raise RBKubeMQ::Error.new(e.message)
end