Class: EventStoreClient::GRPC::Shared::Streams::ProcessResponses

Inherits:
Object
  • Object
show all
Defined in:
lib/event_store_client/adapters/grpc/shared/streams/process_responses.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ ProcessResponses

Returns a new instance of ProcessResponses.

Parameters:



12
13
14
# File 'lib/event_store_client/adapters/grpc/shared/streams/process_responses.rb', line 12

def initialize(config:)
  @config = config
end

Instance Method Details

#call(responses, skip_deserialization, skip_decryption) ⇒ Array<EventStoreClient::DeserializedEvent>, Array<EventStore::Client::Streams::ReadResp>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

Raises:



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

def call(responses, skip_deserialization, skip_decryption)
  non_existing_stream = responses.first&.stream_not_found&.stream_identifier&.stream_name
  raise StreamNotFoundError, non_existing_stream if non_existing_stream
  return responses if skip_deserialization

  responses.map do |response|
    # It could be <EventStore::Client::Streams::ReadResp: last_stream_position: 39> for
    # example. Such responses should be skipped. See generated files for more info.
    next unless response.event&.event

    config.mapper.deserialize(response.event.event, skip_decryption: skip_decryption)
  end.compact
end