Module: TCB
- Defined in:
- lib/tcb.rb,
lib/tcb/domain.rb,
lib/tcb/record.rb,
lib/tcb/publish.rb,
lib/tcb/version.rb,
lib/tcb/event_bus.rb,
lib/tcb/stream_id.rb,
lib/tcb/command_bus.rb,
lib/tcb/event_query.rb,
lib/tcb/configuration.rb,
lib/tcb/rspec_helpers.rb,
lib/tcb/domain_context.rb,
lib/tcb/handles_events.rb,
lib/tcb/records_events.rb,
lib/tcb/handles_commands.rb,
lib/tcb/minitest_helpers.rb,
lib/tcb/event_bus_shutdown.rb,
lib/tcb/test_helpers/shared.rb,
lib/tcb/event_store/in_memory.rb,
lib/tcb/event_store/active_record.rb,
lib/tcb/event_bus/running_strategy.rb,
lib/tcb/event_bus/shutdown_strategy.rb,
lib/tcb/subscriber_invocation_failed.rb,
lib/tcb/event_bus/subscriber_registry.rb,
lib/tcb/subscriber_metadata_extractor.rb,
lib/tcb/event_store/event_stream_envelope.rb,
lib/generators/tcb/domain/domain_generator.rb,
lib/generators/tcb/shared/command_argument.rb,
lib/generators/tcb/install/install_generator.rb,
lib/tcb/event_bus/termination_signal_handler.rb,
lib/generators/tcb/event_store/event_store_generator.rb
Defined Under Namespace
Modules: Domain, Generators, HandlesCommands, HandlesEvents, MinitestHelpers, RSpecHelpers, RecordsEvents, TestHelpers
Classes: Configuration, DomainContext, EventBus, EventBusShutdown, EventQuery, EventStore, Record, StreamId, SubscriberInvocationFailed, SubscriberMetadataExtractor
Constant Summary
collapse
- Envelope =
EventStore::EventStreamEnvelope
- VERSION =
"0.5.0"
- CommandHandlerNotFound =
Class.new(StandardError)
- ConfigurationError =
Class.new(StandardError)
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
115
116
117
|
# File 'lib/tcb/configuration.rb', line 115
def self.config
@config ||= Configuration.new
end
|
45
46
47
48
49
50
|
# File 'lib/tcb.rb', line 45
def self.configure(&block)
@configure_block = block
yield config
config.permitted_serialization_classes
config.freeze
end
|
.dispatch(command) ⇒ Object
5
6
7
8
9
|
# File 'lib/tcb/command_bus.rb', line 5
def self.dispatch(command)
validate!(command)
handler = resolve_handler(command)
handler.new.call(command)
end
|
.publish(*events) ⇒ Object
2
3
4
5
|
# File 'lib/tcb/publish.rb', line 2
def self.publish(*events)
events.each { |event| config.event_bus.publish(event) }
events
end
|
.read(domain_module) ⇒ Object
.record(events_from: [], events: [], within: nil, &block) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/tcb.rb', line 27
def self.record(events_from: [], events: [], within: nil, &block)
Record.call(
events_from: events_from,
events: events,
within: within,
store: config.event_store,
registrations: config.persist_registrations,
&block
)
end
|
.reset! ⇒ Object
52
53
54
55
56
|
# File 'lib/tcb.rb', line 52
def self.reset!
@config.event_bus.force_shutdown
@config = nil
configure(&@configure_block) if @configure_block
end
|