Class: EventStoreClient::HTTP::Commands::PersistentSubscriptions::Create

Inherits:
Command
  • Object
show all
Defined in:
lib/event_store_client/adapters/http/commands/persistent_subscriptions/create.rb

Instance Method Summary collapse

Methods inherited from Command

inherited

Instance Method Details

#call(stream_name, subscription_name, options: {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/event_store_client/adapters/http/commands/persistent_subscriptions/create.rb', line 8

def call(stream_name, subscription_name, options: {})
  stats = options[:stats] || true
  start = options[:start] || 0
  retries = options[:retries] || 5
  max_checkpoint_count = options[:max_checkpoint_count] || 0
  min_checkpoint_count = options[:min_checkpoint_count] || 0

  connection.call(
    :put,
    "/subscriptions/#{stream_name}/#{subscription_name}",
    body: {
      extraStatistics: stats,
      startFrom: start,
      maxRetryCount: retries,
      maxCheckPointCount: max_checkpoint_count,
      minCheckPointCount: min_checkpoint_count,
      resolveLinkTos: true
    },
    headers: {
      'Content-Type' => 'application/json'
    }
  )
end