PacketFlow.Component.Communication (packetflow v0.1.0)
Component communication protocols for inter-component messaging
This module provides:
- Message routing between components
- Protocol definitions for different message types
- Message validation and transformation
- Asynchronous and synchronous communication patterns
- Message queuing and buffering
Summary
Functions
Broadcast a message to multiple components
Returns a specification to start this module under a supervisor.
Get pending requests for debugging
Get communication statistics
Callback implementation for GenServer.init/1
.
Register a message handler for a component
Register a communication protocol
Send a message to a component
Send a synchronous request to a component
Subscribe to messages from a component
Unsubscribe from messages from a component
Types
@type communication_protocol() :: %{ name: atom(), version: String.t(), message_types: [message_type()], validation_rules: map(), transformation_rules: map() }
@type component_message() :: %{ id: message_id(), type: message_type(), from: atom(), to: atom() | [atom()], payload: term(), priority: message_priority(), timestamp: integer(), timeout: integer() | nil, reply_to: pid() | nil, metadata: map() }
@type message_id() :: String.t()
@type message_priority() :: :low | :normal | :high | :urgent
@type message_type() :: :request | :response | :notification | :broadcast | :event
Functions
Broadcast a message to multiple components
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_pending_requests() :: map()
Get pending requests for debugging
@spec get_statistics() :: map()
Get communication statistics
Callback implementation for GenServer.init/1
.
Register a message handler for a component
@spec register_protocol(communication_protocol()) :: :ok | {:error, term()}
Register a communication protocol
Send a message to a component
Send a synchronous request to a component
Subscribe to messages from a component
Unsubscribe from messages from a component