batch

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Batch node

Type: batch
Category: Flow Control

Groups incoming messages into batch sequences.

Behavior

This node is registered as batch and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
allowEmptySequence boolean false Allow Empty Sequence — interval mode: emit an empty sequence message on a window with no input
count integer 10 Count — count mode: number of messages per batch sequence
honourParts boolean false Honour Parts — count mode: flush when an incoming parts sequence completes
interval number 10 Interval (seconds) — interval mode: window length
mode string count Mode
overlap integer 0 Overlap — count mode: messages kept for the next batch
topics array Topics — concat mode: topics whose sequences are concatenated, in output order

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

Documentation

Overview

Package batch contains the batch node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchConfig

type BatchConfig struct {
	// Mode selects grouping: "count" batches every N messages,
	// "interval" flushes everything buffered every Interval seconds,
	// "concat" merges one complete parts sequence per configured topic
	Mode string `json:"mode"`
	// Count is the batch size for "count" mode
	Count int `json:"count"`
	// Overlap keeps the last N messages of a batch for the next batch
	// ("count" mode)
	Overlap int `json:"overlap"`
	// Interval is the window length in seconds for "interval" mode
	Interval float64 `json:"interval"`
	// AllowEmptySequence emits an empty sequence message when an
	// interval window closes with nothing buffered
	AllowEmptySequence bool `json:"allowEmptySequence"`
	// HonourParts flushes a count-mode batch early when an incoming
	// parts sequence completes (parts.index+1 == parts.count)
	HonourParts bool `json:"honourParts"`
	// Topics lists the concat-mode topics in output order; each entry
	// is {"topic": "..."} as serialized by Node-RED
	Topics []struct {
		Topic string `json:"topic"`
	} `json:"topics"`
}

BatchConfig holds configuration for the batch node — the Node-RED batch equivalent. Buffers messages and re-emits them as a parts sequence (count/interval) or concatenates topic sequences (concat).

type BatchNode

type BatchNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

BatchNode re-emits buffered messages as a parts sequence. Buffered messages are dropped (nil return); completed batches go downstream asynchronously through the node's outgoing edges.

func NewBatchNode

func NewBatchNode(node nodestore.NodeInterface, config *BatchConfig, host nodebase.NodeHost) *BatchNode

NewBatchNode creates a new batch node

func (*BatchNode) Execute

Execute buffers the message and, when a batch completes, emits the sequence asynchronously — the triggering message itself is dropped.

func (*BatchNode) Validate

func (n *BatchNode) Validate() error

Validate rejects unsupported modes at deploy time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL