Class: EventStoreClient::GRPC::Commands::Streams::Append

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

Instance Method Summary collapse

Methods inherited from Command

#connection_options, #initialize, #metadata, #request, #service, use_request, use_service

Constructor Details

This class inherits a constructor from EventStoreClient::GRPC::Commands::Command

Instance Method Details

#call(stream_name, event, options:) {|payload| ... } ⇒ Object

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.

Yields:

  • (payload)

See Also:

  • EventStoreClient::GRPC::Commands::Streams::Append.{EventStoreClient{EventStoreClient::GRPC{EventStoreClient::GRPC::Client{EventStoreClient::GRPC::Client#append_to_stream}


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/event_store_client/adapters/grpc/commands/streams/append.rb', line 13

def call(stream_name, event, options:, &blk)
  payload =
    [
      request.new(options: options(stream_name, options)),
      request.new(proposed_message: proposed_message(event))
    ]
  yield(*payload) if blk
  response = retry_request(skip_retry: config.eventstore_url.throw_on_append_failure) do
    service.append(payload, metadata: )
  end
  validate_response(response, caused_by: event)
end