Router

A Router both receives a QObject and immediately sends it onward, choosing the destination as a function of the arriving instance. It is the QObject-aware generalization of QObjectSender: its selectNextReceiver is passed the instance being routed, so data-dependent routing (by type, by condition, by attribute) is expressible directly.

A router exposes its candidate destinations so that a StationNetwork can introspect and validate the routing graph.

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val hasOnwardRouting: Boolean

True if this node has any onward routing configured (a static next receiver, a station-level sender, or a class route). A non-terminal node for which this is false — and which is not a non-terminal step of a registered route — is a dangling node and fails validation.

Functions

Link copied to clipboard

Action invoked just after the selected receiver receives the instance.

Link copied to clipboard

Action invoked just before the selected receiver receives the instance.

Link copied to clipboard

The possible destinations this router may select, for graph introspection.

Link copied to clipboard

The statically known receivers this node may route to. Best-effort: empty when the node has no static link or when its routing is opaque (for example, a probabilistic sender whose destinations are not introspectable).

Link copied to clipboard
override fun receive(arrivingQObject: ModelElement.QObject)
Link copied to clipboard
open fun resetRouter()

Resets any per-replication routing state to its initial condition. Stateless routers need not override this. A StationNetwork calls this on each registered router at the start of every replication, so stateful routers (for example, round-robin) should be registered with the network.

Link copied to clipboard

Selects the receiver for the supplied qObject. Implementations must return a non-null receiver; supply a default/fallback to guarantee this.

Link copied to clipboard
override fun send(qObject: ModelElement.QObject)