Class: EventStoreClient::GRPC::Commands::Streams::Subscribe

Inherits:
Command
  • Object
show all
Includes:
Configuration
Defined in:
lib/event_store_client/adapters/grpc/commands/streams/subscribe.rb

Constant Summary collapse

StreamNotFound =
Class.new(StandardError)

Instance Method Summary collapse

Methods included from Configuration

#config

Methods inherited from Command

inherited, #metadata

Instance Method Details

#call(options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/event_store_client/adapters/grpc/commands/streams/subscribe.rb', line 22

def call(options = {})
  opts = options_with_defaults(options)

  service.read(request.new(options: opts), metadata: ).map do |res|
    raise StreamNotFound if res.stream_not_found

    yield prepared_response(res) if block_given?
  end
rescue StreamNotFound
  Failure(:not_found)
end