Class: EventStoreClient::GRPC::Client
- Inherits:
-
Object
- Object
- EventStoreClient::GRPC::Client
- Includes:
- Configuration
- Defined in:
- lib/event_store_client/adapters/grpc/client.rb
Instance Method Summary collapse
-
#append_to_stream(stream_name, events, options: {}) ⇒ Object
Appends given events to the stream.
-
#delete_stream(stream_name, options: {}) ⇒ Object
Softly deletes the given stream.
-
#link_to(stream_name, events, options: {}) ⇒ Object
Links given events with the given stream.
-
#listen(subscription, options: {}) ⇒ Object
Runs the persistent subscription indeinitely.
-
#read(stream_name, options: {}) ⇒ Object
Reads a page of events from the given stream.
-
#read_all_from_stream(stream_name, options: {}) ⇒ Object
Reads all events from the given stream.
-
#subscribe_to_stream(subscription, options: {}) ⇒ Object
Creates the subscription for the given stream.
-
#tombstone_stream(stream_name, options: {}) ⇒ Object
Completely removes the given stream.
Methods included from Configuration
Instance Method Details
#append_to_stream(stream_name, events, options: {}) ⇒ Object
Appends given events to the stream
12 13 14 15 16 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 12 def append_to_stream(stream_name, events, options: {}) Commands::Streams::Append.new.call( stream_name, events, options: {} ) end |
#delete_stream(stream_name, options: {}) ⇒ Object
Softly deletes the given stream
23 24 25 26 27 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 23 def delete_stream(stream_name, options: {}) Commands::Streams::Delete.new.call( stream_name, options: ) end |
#link_to(stream_name, events, options: {}) ⇒ Object
Links given events with the given stream
76 77 78 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 76 def link_to(stream_name, events, options: {}) Commands::Streams::LinkTo.new.call(stream_name, events, options: ) end |
#listen(subscription, options: {}) ⇒ Object
Runs the persistent subscription indeinitely
85 86 87 88 89 90 91 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 85 def listen(subscription, options: {}) consume_feed(subscription, options: ) do |event| yield event if block_given? end rescue StandardError => e config.error_handler&.call(e) end |
#read(stream_name, options: {}) ⇒ Object
Reads a page of events from the given stream
43 44 45 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 43 def read(stream_name, options: {}) Commands::Streams::Read.new.call(stream_name, options: ) end |
#read_all_from_stream(stream_name, options: {}) ⇒ Object
Reads all events from the given stream
52 53 54 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 52 def read_all_from_stream(stream_name, options: {}) Commands::Streams::ReadAll.new.call(stream_name, options: ) end |
#subscribe_to_stream(subscription, options: {}) ⇒ Object
Creates the subscription for the given stream
61 62 63 64 65 66 67 68 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 61 def subscribe_to_stream(subscription, options: {}) join_streams(subscription.name, subscription.observed_streams) Commands::PersistentSubscriptions::Create.new.call( subscription.stream, subscription.name, options: ) end |
#tombstone_stream(stream_name, options: {}) ⇒ Object
Completely removes the given stream
34 35 36 |
# File 'lib/event_store_client/adapters/grpc/client.rb', line 34 def tombstone_stream(stream_name, options: {}) Commands::Streams::Tombstone.new.call(stream_name, options: ) end |