thenFork

fun <ItemT, R> NodeBuilder<ItemT, ChannelType.Push>.thenFork(label: String, lanes: List<(RegularNodeBuilder<PushForkNode<ItemT>, ItemT, ChannelType.Push>) -> R>, policy: ForkPolicy<ItemT> = forkPolicy(RandomPolicy())): List<R>

Attaches a fork node to the builder chain, which splits the current builder chain to numLanes parallel lanes, whose behaviour is determined by laneAction. The subsequent lanes will commence with a push input connection from the fork.

When used in combination of other nodes, could construct (for example):

  • with Join -> parallel lanes for traffic to flow through / different paths for different types of port vehicles

  • with PushConnection -> lane for traffic to head to a previous point in the network, or to join a different network entirely.

Parameters

lanes

List of DSL node builder chains to follow, each starting with a pull output connection from this fork node. Read more here.

policy

How the fork node will decide which lane to push traffic to, when the upstream node pushes traffic into us


fun <ItemT, R> NodeBuilder<ItemT, ChannelType.Push>.thenFork(label: String, numLanes: Int, policy: ForkPolicy<ItemT> = forkPolicy(RandomPolicy()), laneAction: (Int, RegularNodeBuilder<PushForkNode<ItemT>, ItemT, ChannelType.Push>) -> R): List<R>

Attaches a fork node to the builder chain, which splits the current builder chain to numLanes parallel lanes, whose behaviour is determined by laneAction. The subsequent lanes will commence with a push input connection from the fork.

When used in combination of other nodes, could construct (for example):

  • with Join -> parallel lanes for traffic to flow through / different paths for different types of port vehicles

  • with PushConnection -> lane for traffic to head to a previous point in the network, or to join a different network entirely.

Parameters

numLanes

The number of lanes to construct with the provided laneAction function

policy

How the fork node will decide which lane to push traffic to, when the upstream node pushes traffic into us

laneAction

Function that determines the contents of each lane, depending on the lane number. Read more here.


Attaches a fork node to the builder chain, which splits the current builder chain to numLanes parallel lanes, whose behaviour is determined by laneAction. The subsequent lanes will commence with a pull input connection from the fork.

When used in combination of other nodes, could construct (for example):

  • with Join -> parallel lanes for traffic to flow through / different paths for different types of port vehicles

  • with PushConnection -> lane for traffic to head to a previous point in the network, or to join a different network entirely.

Parameters

lanes

List of DSL node builder chains to follow, each starting with a pull output connection from this fork node. Read more here.


Attaches a fork node to the builder chain, which splits the current builder chain to numLanes parallel lanes, whose behaviour is determined by laneAction. The subsequent lanes will commence with a pull input connection from the fork.

When used in combination of other nodes, could construct (for example):

  • with Join -> parallel lanes for traffic to flow through / different paths for different types of port vehicles

  • with PushConnection -> lane for traffic to head to a previous point in the network, or to join a different network entirely.

Parameters

numLanes

The number of lanes to construct with the provided laneAction function

laneAction

Function that determines the contents of each lane, depending on the lane number. Read more here.