class EventStoreClient::GRPC::Commands::PersistentSubscriptions::Update

Public Instance Methods

call(stream, group, options: {}) click to toggle source

Creates persistent subscription in a given group @param [String] name of the subscription stream to update @param [String] name of the subscription group @param [Hash] options - additional settings to be set on subscription.

Refer to EventStoreClient::GRPC::Commands::SettingsSchema
for detailed attributes schema

@return [Dry::Monads::Result::Success, Dry::Monads::Result::Failure]

# File lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/update.rb, line 26
def call(stream, group, options: {})
  schema = SettingsSchema.call(options)
  return Failure(schema.errors) if schema.failure?

  opts =
    {
      stream_identifier: {
        streamName: stream
      },
      group_name: group,
      settings: schema.to_h
    }
  service.update(request.new(options: opts), metadata: metadata)
  Success()
rescue ::GRPC::Unknown => e
  return Failure(:not_found) if e.message.include?('DoesNotExist')
  raise e
end