Message Stack

Store and retrieve messages from a stack/queue with optional delay processing

Overview

This node manages a message stack (queue) allowing users to push, pop, peek, flush, and clear messages. It supports delayed processing where messages can be accumulated for a specified delay before being processed or flushed. This is useful in scenarios where batch processing of messages is desired, such as accumulating events or data points before sending them onward, or controlling message flow in workflows.

Use Case Examples

  1. Push messages to a named stack and later pop them for processing.
  2. Push messages with a delay to accumulate multiple messages before processing them together.
  3. Flush all messages from the stack after a delay, returning all accumulated messages at once.

Properties

Name Meaning
Stack Name The name of the stack to operate on, allowing multiple independent stacks.
Delay (Seconds) Time to wait for accumulating messages before processing (used in delayed push operations).
Auto Flush on Delay Whether to automatically flush messages after the delay period (used in delayed push operations).
Return Format How to return the messages, either as individual items or as a single array.

Output

JSON

  • success - Indicates if the operation was successful.
  • operation - The operation performed on the stack.
  • stackName - The name of the stack operated on.
  • messagesPushed - Number of messages pushed to the stack (for push operations).
  • totalMessages - Total number of messages currently in the stack.
  • messagesReturned - Number of messages returned from the stack (for pop, flush, pushWaitFlush).
  • messages - Array of messages returned from the stack.
  • count - Count of messages returned or processed.
  • delaySeconds - Configured delay time in seconds for delayed operations.
  • autoFlush - Indicates if auto flush is enabled for delayed operations.
  • willFlushAt - Timestamp when the stack will auto flush (if enabled).
  • actualWaitTimeSeconds - Actual time waited during pushWaitFlush operation.
  • message - Informational message about the stack state (e.g., empty stack).
  • size - Current size of the stack (number of messages).
  • lastActivity - Timestamp of the last activity on the stack.
  • hasPendingTimeout - Indicates if there is a pending timeout for auto flush.
  • messagesCleared - Number of messages cleared from the stack.

Troubleshooting

  • If the operation parameter is invalid, the node throws an error indicating the operation is not supported. Ensure the operation is one of the supported options: push, pop, peek, flush, size, clear, pushWithDelay, pushWaitFlush.
  • If using delayed operations, ensure the delaySeconds parameter is set appropriately to avoid unexpected behavior or premature flushing.
  • When returning messages in 'individual' format, large message volumes may result in many output items; consider using 'array' format for batch processing.

Discussion