Documentation
¶
Overview ¶
This file provides the "queue-dispatch" block: it sends the current message to a queue subject to load balance work across replicas. By default it does a fire-and-forget Publish and returns the message unchanged — dispatching is the common case. With awaitReply it instead does a Request, waiting for one competing consumer to handle the message and folding the reply's body and variables back in (the cross-replica analogue of a two-way flow-ref). The subject is a CEL expression evaluated per message, so a flow can route or shard work dynamically.
Package queue exposes the platform's core queue service to flows as first-class DSL constructs: a message source that runs each queued message through a flow, and the "queue-dispatch" block that sends the current message to a subject. Together they make the cluster's competing-consumer queues the way flows load balance work across replicas — the cross-replica analogue of the in-process flow-ref block.
The queue itself is a core runtime service (core.Queues, reached via core.RuntimeServicesFromContext), in-process in the standalone module and NATS-backed in the k8s module. This connector holds no transport of its own; it only owns the request/response correlation needed to turn a queue Request into a flow execution and return the flow's result as the reply. That correlation rides the process-wide flow-event bus exactly as the HTTP connector does: every terminal FlowEvent carries the result message keyed by EventID, which a parked source handler matches against its pending registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector owns the request/response registry shared by the queue sources it builds. It has no settings and no transport: a source subscribes to the core queue service itself (from the context at start), and the connector only rendezvouses completed flows back to the parked handlers through its pending map, fed by the flow-event bus it subscribes to once in Start.
func (*Connector) NewSource ¶
func (c *Connector) NewSource( cfg types.SourceConfig, out chan<- *types.Message, _ core.SourceDeps, ) (core.MessageSource, error)
NewSource builds a queue source, validating its subject up front. The subscription itself is opened in Start, where the runtime services (and so the queue backend) are available on the context.