Class: RailsEventStore::JSONClient
- Defined in:
- lib/rails_event_store/json_client.rb
Instance Attribute Summary
Attributes inherited from Client
Instance Method Summary collapse
Methods inherited from Client
Constructor Details
#initialize(mapper: RubyEventStore::Mappers::PipelineMapper.new( RubyEventStore::Mappers::Pipeline.new( RubyEventStore::Mappers::Transformation::PreserveTypes .new .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym }) .register( Time, serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) }, deserializer: ->(v) { Time.iso8601(v) } ) .register( ActiveSupport::TimeWithZone, serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) }, deserializer: ->(v) { Time.iso8601(v).in_time_zone }, stored_type: ->(*) { "ActiveSupport::TimeWithZone" } ) .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) }) .register(DateTime, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { DateTime.iso8601(v) }) .register(BigDecimal, serializer: ->(v) { v.to_s }, deserializer: ->(v) { BigDecimal(v) }) .register(OpenStruct, serializer: ->(v) { v.to_h }, deserializer: ->(v) { OpenStruct.new(v) }), RubyEventStore::Mappers::Transformation::SymbolizeMetadataKeys.new ) ), repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::NULL), 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) ⇒ JSONClient
Returns a new instance of JSONClient.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rails_event_store/json_client.rb', line 5 def initialize( mapper: RubyEventStore::Mappers::PipelineMapper.new( RubyEventStore::Mappers::Pipeline.new( RubyEventStore::Mappers::Transformation::PreserveTypes .new .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym }) .register( Time, serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) }, deserializer: ->(v) { Time.iso8601(v) } ) .register( ActiveSupport::TimeWithZone, serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) }, deserializer: ->(v) { Time.iso8601(v).in_time_zone }, stored_type: ->(*) { "ActiveSupport::TimeWithZone" } ) .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) }) .register(DateTime, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { DateTime.iso8601(v) }) .register(BigDecimal, serializer: ->(v) { v.to_s }, deserializer: ->(v) { BigDecimal(v) }) .register(OpenStruct, serializer: ->(v) { v.to_h }, deserializer: ->(v) { OpenStruct.new(v) }), RubyEventStore::Mappers::Transformation::SymbolizeMetadataKeys.new ) ), repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::NULL), 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( mapper: RubyEventStore::Mappers::InstrumentedMapper.new(mapper, ActiveSupport::Notifications), repository: RubyEventStore::InstrumentedRepository.new(repository, 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 |