Class: EventStoreClient::GRPC::Commands::PersistentSubscriptions::Create
- Inherits:
-
Command
- Object
- Command
- EventStoreClient::GRPC::Commands::PersistentSubscriptions::Create
- Defined in:
- lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/create.rb
Instance Method Summary collapse
-
#call(stream, group, options: {}) ⇒ Dry::Monads::Result::Success, Dry::Monads::Result::Failure
Creates persistent subscription in a given group.
Methods inherited from Command
Methods included from Configuration
Instance Method Details
#call(stream, group, options: {}) ⇒ Dry::Monads::Result::Success, Dry::Monads::Result::Failure
Creates persistent subscription in a given group
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/event_store_client/adapters/grpc/commands/persistent_subscriptions/create.rb', line 25 def call(stream, group, options: {}) schema = SettingsSchema.call() return Failure(schema.errors) if schema.failure? opts = { stream_identifier: { streamName: stream }, group_name: group, settings: schema.to_h } service.create(request.new(options: opts), metadata: ) Success() rescue ::GRPC::AlreadyExists Failure(:conflict) end |