class PulsarSdk::Options::Connection

Constants

DEFAULT_PORT

Attributes

auth_provider[RW]
connection_timeout[RW]
keepalive[RW]
logical_addr[RW]
operation_timeout[RW]
physical_addr[RW]
tls_options[RW]

Public Instance Methods

connecting_through_proxy?() click to toggle source
# File lib/pulsar_sdk/options/connection.rb, line 22
def connecting_through_proxy?
  logical_addr == physical_addr
end
port_and_host_from(name) click to toggle source
# File lib/pulsar_sdk/options/connection.rb, line 30
def port_and_host_from(name)
  v = instance_variable_get("@#{name}")
  return if v.nil?
  [v.port, v.host]
end
proxy_to_broker_url() click to toggle source
# File lib/pulsar_sdk/options/connection.rb, line 26
def proxy_to_broker_url
  connecting_through_proxy? ? logical_addr : nil
end

Private Instance Methods

set_default() click to toggle source
# File lib/pulsar_sdk/options/connection.rb, line 37
def set_default
  self.logical_addr = ENV.fetch("PULSAR_BROKER_URL", nil)

  # 连接5秒超时
  self.connection_timeout = 5

  # Set the operation timeout (default: 30 seconds)
  # Producer-create, subscribe and unsubscribe operations will be retried until this interval
  self.operation_timeout = 30

  self.keepalive = 30
end