Object.MessageRouter (object v0.1.2)
High-performance message routing service using GenStage for backpressure. Handles message delivery between objects with priority queuing and load balancing.
Summary
Functions
Gets active dyads from router state.
Gets objects from router state.
Gets performance statistics for the message router.
Creates a new message router for the given objects and dyads.
Processes a batch of messages through the router.
Routes a message through the system with priority queuing.
Starts the message router GenStage producer.
Updates the router topology with new dyads.
Functions
Gets active dyads from router state.
Gets objects from router state.
Gets performance statistics for the message router.
Returns
Map with pending messages, delivery rate, success/failure counts
Creates a new message router for the given objects and dyads.
Parameters
objects
: List of objects to route messages betweeninitial_dyads
: Initial dyad connections
Returns
Router state with initialized routing state
Processes a batch of messages through the router.
Parameters
router_state
: Current router statemessage_batch
: List of messages to process
Returns
{updated_router_state, batch_results}
where batch_results contains delivery statistics
Routes a message through the system with priority queuing.
Parameters
message
: Message struct with routing information
Returns
:ok
- message is queued for delivery
Examples
iex> message = %{id: "msg1", from: "obj1", to: "obj2", ...}
iex> Object.MessageRouter.route_message(message)
:ok
Starts the message router GenStage producer.
Returns
{:ok, pid}
on successful startup
Updates the router topology with new dyads.