class BPS::Publisher::STAN

Public Class Methods

new(cluster_id, client_id, **opts) click to toggle source

@param [String] cluster ID. @param [String] client ID. @param [Hash] options.

Calls superclass method
# File lib/bps/publisher/stan.rb, line 27
def initialize(cluster_id, client_id, **opts)
  super()

  @topics = {}
  @client = ::BPS::STAN.connect(cluster_id, client_id, **opts)
end

Public Instance Methods

close() click to toggle source
# File lib/bps/publisher/stan.rb, line 38
def close
  # NATS/STAN does not survive multi-closes, so close only once:
  @client&.close
  @client = nil
end
topic(name) click to toggle source
# File lib/bps/publisher/stan.rb, line 34
def topic(name)
  @topics[name] ||= self.class::Topic.new(@client, name)
end