This is a computer translation of the original content. It is provided for general information only and should not be relied upon as complete or accurate.

Sorry, we can't translate this content right now, please try again later.

Use Concurrency Limits

To control the number of instances of a single node, you can use the concurrency limit on the node. To cause it to reject messages after it reaches its concurrency limit, you construct it as a "rejecting" node.

A function node is constructed with one or more template arguments. The third argument controls the buffer policy used by the node, and is by default queueing. With a queueing policy, a function_node that has reached its concurrency limit still accepts incoming messages, but buffers them internally. If the policy is set to rejecting the node will instead reject the incoming messages.

The function_node will operate on at most three big objects concurrently. The node's concurrency threshold that limits the node to three concurrent invocations. When the function_node is running three instances concurrently, it will start rejecting incoming messages from the source_node, causing the source_node to buffer its last created object and temporarily stop invoking its body object. Whenever the function_node drops below its concurrency limit, it will pull new messages from the source_node. At most four big objects will exist simultaneously, three in the function_node and one buffered in the source_node.