lib/redis/stream/client.rb
# add: add a message to the stream
# @param [Object] data                    Any data you want to transmit
# @param [Hash{String->String}]           Options
#
# no passthrough variable here. The passthrough is available in the start method
add a message to the stream
add a message to the stream
def add(data = {}, options = {})
        raise "Client isn't running" unless @state.eql?(Redis::Stream::State::RUNNING)
        add_id = nil
        OpenTracing.start_active_span('add') do |scope|
          default_options = {"to" => "*", "group" => "*", "type" => Redis::Stream::Type::ACTION, "cache_key" => nil, "tracer" => nil}
          options = default_options.merge(options)
          type = options["type"]
          to = options["to"]
          group = options["group"]
          payload = build_payload(data, options)
          add_id = nil
          @redis_pool.with do |redis|
            add_id = redis.xadd(@stream, payload)
          end
          @logger.info("#{@consumer_id} - send to '#{to}' in group '#{group}' with id '#{add_id}' of type '#{type}'")
        end
        add_id
      end
def add ( data = { } , options = { } ) raise "Client isn't running" unless @state . eql? ( Redis :: Stream :: State :: RUNNING ) add_id = nil OpenTracing . start_active_span ( 'add' ) do | scope | default_options = { "to" => "*" , "group" => "*" , "type" => Redis :: Stream :: Type :: ACTION , "cache_key" => nil , "tracer" => nil } options = default_options . merge ( options ) type = options [ "type" ] to = options [ "to" ] group = options [ "group" ] payload = build_payload ( data , options ) add_id = nil @redis_pool . with do | redis | add_id = redis . xadd ( @stream , payload ) end @logger . info ( "#{@consumer_id} - send to '#{to}' in group '#{group}' with id '#{add_id}' of type '#{type}'" ) end add_id end
add: add a message to the stream
add : add a message to the stream
data
options
Options no passthrough variable here. The passthrough is available in the start method
Options no passthrough variable here . The passthrough is available in the start method