EdgesBuilder

The receiver that collects the edges declared in an edges or workflow block. A node is identified by its instance, so create each node once and reuse it. To add a tool as a step, convert it once with asNode and reuse that node.

Functions

Link copied to clipboard
fun anyOf(first: Route, second: Route, vararg rest: Route): RouteSet

Groups routes for on, so one edge fires on any of them.

fun anyOf(first: Int, second: Int, vararg rest: Int): RouteSet

Groups number routes for on, so one edge fires on any of them.

fun anyOf(first: String, second: String, vararg rest: String): RouteSet

Groups string routes for on, so one edge fires on any of them.

Link copied to clipboard
fun chain(first: Node, second: Node, vararg rest: Node): Node

Connects first, second, and each node in rest in order by adding an edge from each node to the next. Returns the last node so the chain can continue from it: chain(Start, a, b) is short for Start.then(a).then(b).

fun Node.chain(first: Node, second: Node, vararg rest: Node): Node

Connects this node to first, second, and each node in rest in order by adding an edge from each node to the next, and returns the last node. a.chain(b, c) is short for a.then(b).then(c). Unlike the chain overload that takes the first node as an argument, this form can continue a fluent chain, such as after joinTo.

Link copied to clipboard
fun from(node: Node): EdgeChain

Starts a chain of edges at node for Java callers. Its calls add the same edges as the Kotlin calls of the same names: g.from(a).then(b).then(c).

Starts a chain of edges at group (such as one built with nodes) for Java callers so the group can join without a fan-out.

Starts a chain of edges at nodes (such as a computed list) for Java callers so the nodes can join without a fan-out. For a fixed set of nodes, the g.from(a, b) overload is shorter.

fun from(first: Node, second: Node, vararg rest: Node): NodeGroupChain

Starts a chain of edges at first, second, and each node in rest for Java callers so they can join without a fan-out: g.from(a, b).joinTo(join).

Link copied to clipboard

Starts a chain of edges at Start for Java callers: g.fromStart().then(a) instead of g.from(Start.INSTANCE).then(a).

Link copied to clipboard
fun JoinNode.joinFrom(first: Node, vararg rest: Node): Node

Fans in: connects first and each of rest to this join, which runs once all of them complete. Returns the join, so a chain continues from it.

Link copied to clipboard

Fans in by connecting each node of this group to join, which runs once all of them complete. Returns join so the chain continues from it: a.then(b, c).joinTo(join).then(d).

Fans in by connecting each node in this collection, such as a computed list, to join, like nodes(...).joinTo(join). Returns join so the chain continues from it. An empty collection adds no edges.

Link copied to clipboard
fun nodes(vararg nodes: Node): NodeGroup

Groups nodes without connecting them, as in a then nodes(b, c) for an infix fan-out or nodes(b, c).joinTo(join) for a join. Prefer this over listOf(b, c) for fan-outs and joins because listOf infers the nodes' closest common supertype. For some built-in nodes of different types, such as a Workflow and a JoinNode, that supertype is the framework-internal BaseNode, so the call fails to compile.

Link copied to clipboard
infix fun Node.on(route: Route): PendingEdge

Starts an edge that fires when this node emits route; then completes it.

infix fun Node.on(routes: RouteSet): PendingEdge

Starts one edge that fires once when this node emits any of routes (built with anyOf); then completes it.

infix fun Node.on(route: Boolean): PendingEdge

Starts an edge that fires when this node emits route as a Route.Flag; then completes it.

infix fun Node.on(route: Int): PendingEdge

Starts an edge that fires when this node emits route as a Route.Num; then completes it.

infix fun Node.on(route: String): PendingEdge

Starts an edge that fires when this node emits route as a Route.Tag; then completes it.

Link copied to clipboard

Adds this node's routing map, with an edge for each route block maps to a node. A routing map ends the statement; connect its targets onward in separate statements. An empty map throws IllegalArgumentException, and an entry not completed with then throws IllegalStateException.

Link copied to clipboard

Connects this node to node and returns node, so a chain continues from it.

Fans out to each node in targets so they run concurrently, as in a then nodes(b, c). Returns targets, which joinTo connects to a JoinNode to continue once they all complete.

Fans out by connecting this node to each of targets, such as a computed list, and returns them as a NodeGroup, like then(nodes(...)). An empty collection adds no edges.

Completes this routed edge at node and returns node, so a chain continues from it.

fun Node.then(first: Node, second: Node, vararg rest: Node): NodeGroup

Fans out by connecting this node to first, second, and each node in rest so they run concurrently, as in a.then(b, c). Returns them as a NodeGroup for joinTo. Infix chains still need a then nodes(b, c) because an infix call takes one argument.