Class: RailsEventStore::Client

Inherits:
RubyEventStore::Client
  • Object
show all
Defined in:
lib/rails_event_store/client.rb

Direct Known Subclasses

JSONClient

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapper: RubyEventStore::Mappers::Default.new, repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::Serializers::YAML), subscriptions: RubyEventStore::Subscriptions.new, dispatcher: RubyEventStore::ComposedDispatcher.new( RailsEventStore::AfterCommitAsyncDispatcher.new( scheduler: ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML) ), RubyEventStore::Dispatcher.new ), clock: default_clock, correlation_id_generator: default_correlation_id_generator, request_metadata: default_request_metadata) ⇒ Client

Returns a new instance of Client.



7
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/rails_event_store/client.rb', line 7

def initialize(
  mapper: RubyEventStore::Mappers::Default.new,
  repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::Serializers::YAML),
  subscriptions: RubyEventStore::Subscriptions.new,
  dispatcher: RubyEventStore::ComposedDispatcher.new(
    RailsEventStore::AfterCommitAsyncDispatcher.new(
      scheduler: ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML)
    ),
    RubyEventStore::Dispatcher.new
  ),
  clock: default_clock,
  correlation_id_generator: default_correlation_id_generator,
  request_metadata: 
)
  super(
    repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
    mapper: RubyEventStore::Mappers::InstrumentedMapper.new(mapper, ActiveSupport::Notifications),
    subscriptions: RubyEventStore::InstrumentedSubscriptions.new(subscriptions, ActiveSupport::Notifications),
    clock: clock,
    correlation_id_generator: correlation_id_generator,
    dispatcher: RubyEventStore::InstrumentedDispatcher.new(dispatcher, ActiveSupport::Notifications)
  )
  @request_metadata = 
end

Instance Attribute Details

#request_metadataObject (readonly)

Returns the value of attribute request_metadata.



5
6
7
# File 'lib/rails_event_store/client.rb', line 5

def 
  @request_metadata
end

Instance Method Details

#with_request_metadata(env, &block) ⇒ Object



32
33
34
# File 'lib/rails_event_store/client.rb', line 32

def (env, &block)
  (.call(env)) { block.call }
end