Class: Prosody::Client
- Inherits:
-
Object
- Object
- Prosody::Client
- Includes:
- State::Reading
- Defined in:
- lib/prosody/native_stubs.rb,
lib/prosody/state.rb,
lib/prosody/request.rb,
sig/prosody.rbs,
sig/request.rbs
Overview
Main client for interacting with the Prosody messaging system. Provides methods for sending messages and subscribing to Kafka topics.
Class Method Summary collapse
-
.new(config) ⇒ Client
Creates a new Prosody client with the given configuration.
Instance Method Summary collapse
-
#assigned_partitions ⇒ Integer
Returns the number of Kafka partitions currently assigned to this consumer.
-
#consumer_state ⇒ Symbol
Returns the current state of the consumer.
-
#excise(topic, key) ⇒ void
Sends an excise record for a key.
-
#is_stalled? ⇒ Boolean
Checks if the consumer is stalled.
- #native_request(_request) ⇒ outcomes[json_value]
- #native_request_excise ⇒ outcomes[json_value]
- #published_deque(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
- #published_map(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
- #published_value(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
-
#request(topic:, key:, payload:, subsystems:, timeout:) ⇒ Object
The timeout value uses seconds.
-
#request_excise(topic:, key:, subsystems:, timeout:) ⇒ Object
Returns one excise outcome for each subsystem.
-
#send_message(topic, key, payload) ⇒ void
Sends a message to the specified Kafka topic.
-
#shutdown ⇒ void
Shuts down all client services.
-
#source_system ⇒ String
Returns the configured source system identifier.
- #state ⇒ Object
-
#subscribe(handler) ⇒ void
Subscribes to Kafka topics using the provided handler.
-
#unsubscribe ⇒ void
Unsubscribes from all topics, stopping message processing.
Class Method Details
Instance Method Details
#assigned_partitions ⇒ Integer
Returns the number of Kafka partitions currently assigned to this consumer.
421 422 423 |
# File 'lib/prosody/native_stubs.rb', line 421 def assigned_partitions raise NotImplementedError, "This method is implemented natively in Rust" end |
#consumer_state ⇒ Symbol
Returns the current state of the consumer.
407 408 409 |
# File 'lib/prosody/native_stubs.rb', line 407 def consumer_state raise NotImplementedError, "This method is implemented natively in Rust" end |
#excise(topic, key) ⇒ void
This method returns an undefined value.
Sends an excise record for a key.
458 459 460 |
# File 'lib/prosody/native_stubs.rb', line 458 def excise(topic, key) raise NotImplementedError, "This method is implemented natively in Rust" end |
#is_stalled? ⇒ Boolean
Checks if the consumer is stalled.
A stalled consumer is one that has stopped processing messages due to errors or reaching processing limits.
432 433 434 |
# File 'lib/prosody/native_stubs.rb', line 432 def is_stalled? raise NotImplementedError, "This method is implemented natively in Rust" end |
#native_request(_request) ⇒ outcomes[json_value]
411 412 413 |
# File 'lib/prosody/native_stubs.rb', line 411 def native_request(_request) raise NotImplementedError, "This method is implemented natively in Rust" end |
#native_request_excise ⇒ outcomes[json_value]
64 |
# File 'sig/request.rbs', line 64
def native_request_excise: (native_excise_request request) -> outcomes[json_value]
|
#published_deque(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
536 537 538 |
# File 'lib/prosody/native_stubs.rb', line 536 def published_deque(subsystem, name, read_cache, read_cache_disabled) raise NotImplementedError, "This method is implemented natively in Rust" end |
#published_map(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
531 532 533 |
# File 'lib/prosody/native_stubs.rb', line 531 def published_map(subsystem, name, read_cache, read_cache_disabled) raise NotImplementedError, "This method is implemented natively in Rust" end |
#published_value(subsystem, name, read_cache, read_cache_disabled) ⇒ Object
526 527 528 |
# File 'lib/prosody/native_stubs.rb', line 526 def published_value(subsystem, name, read_cache, read_cache_disabled) raise NotImplementedError, "This method is implemented natively in Rust" end |
#request(topic:, key:, payload:, subsystems:, timeout:) ⇒ Object
The timeout value uses seconds. The method raises if the request cannot start or the Kafka send fails.
25 26 27 28 29 30 31 32 33 |
# File 'lib/prosody/request.rb', line 25 def request(topic:, key:, payload:, subsystems:, timeout:) native_request( topic: topic, key: key, payload: payload, subsystems: subsystems, timeout: timeout ) end |
#request_excise(topic:, key:, subsystems:, timeout:) ⇒ Object
Returns one excise outcome for each subsystem.
36 37 38 39 40 41 42 43 |
# File 'lib/prosody/request.rb', line 36 def request_excise(topic:, key:, subsystems:, timeout:) native_request_excise( topic: topic, key: key, subsystems: subsystems, timeout: timeout ) end |
#send_message(topic, key, payload) ⇒ void
This method returns an undefined value.
Sends a message to the specified Kafka topic.
448 449 450 |
# File 'lib/prosody/native_stubs.rb', line 448 def (topic, key, payload) raise NotImplementedError, "This method is implemented natively in Rust" end |
#shutdown ⇒ void
This method returns an undefined value.
Shuts down all client services. Concurrent and repeated calls wait for the same shutdown operation.
508 509 510 |
# File 'lib/prosody/native_stubs.rb', line 508 def shutdown raise NotImplementedError, "This method is implemented natively in Rust" end |
#source_system ⇒ String
Returns the configured source system identifier.
The source system is used to identify the originating service or component in produced messages, enabling loop detection.
521 522 523 |
# File 'lib/prosody/native_stubs.rb', line 521 def source_system raise NotImplementedError, "This method is implemented natively in Rust" end |
#state ⇒ void #state ⇒ void #state ⇒ void
213 214 215 |
# File 'sig/prosody.rbs', line 213
def state: [T] (_ToS subsystem, _ValueDefinition[T] definition) -> PublishedValue[T]
| [V] (_ToS subsystem, _MapDefinition[V] definition) -> PublishedMap[V]
| [T] (_ToS subsystem, _DequeDefinition[T] definition) -> PublishedDeque[T]
|
#subscribe(handler) ⇒ void
This method returns an undefined value.
Subscribes to Kafka topics using the provided handler.
The handler must implement an on_message(context, message) method.
485 486 487 |
# File 'lib/prosody/native_stubs.rb', line 485 def subscribe(handler) raise NotImplementedError, "This method is implemented natively in Rust" end |
#unsubscribe ⇒ void
This method returns an undefined value.
Unsubscribes from all topics, stopping message processing.
497 498 499 |
# File 'lib/prosody/native_stubs.rb', line 497 def unsubscribe raise NotImplementedError, "This method is implemented natively in Rust" end |