> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/devops/api-event-and-process-flows/configuring-saga-steps/event-step/flow-actions/buffer-payloads.md).

# Buffer Payloads

## Buffer Payloads Actions

### Buffer

Buffers payload of the events received and releases them as a single combined event with array of input payloads in either of the following cases:

* When the runner performs a commit operation, based on its settings or a commit command received.
* When the number of buffered events reaches the buffer size provided in event parameters.

Event metadata fields applicable for this action are as follows:

{% tabs %}
{% tab title="Table" %}

| Field          | Definition                                            | Example    | Default |
| -------------- | ----------------------------------------------------- | ---------- | ------- |
| Input Element  | Json path for payload element to buffer               | parameters | -       |
| Output Element | Json path for payload element to output buffered data | batch      | -       |
| {% endtab %}   |                                                       |            |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "inputElement": {
          "type": "string",
          "definition": "Json path for payload element to buffer",
          "example": "parameters",
          "default": null
        },
        "outputElement": {
          "type": "string",
          "definition": "Json path for payload element to output buffered data",
          "example": "batch",
          "default": null
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

With event metadata parameters as:

{% tabs %}
{% tab title="Table" %}

| Parameter      | Definition                                                  | Example           | Default |
| -------------- | ----------------------------------------------------------- | ----------------- | ------- |
| Input Pattern  | JMES path for transforming input element                    | {"id": productid} | -       |
| Output Pattern | JMES path for transforming buffered data, which is an array | @\[?id>0]         | -       |
| Buffer ID      | Unique id for buffering similar payloads together           | product\_ids      | -       |
| Buffer Size    | Max number of records to buffer                             | 10                | -       |
| {% endtab %}   |                                                             |                   |         |

{% tab title="JSON Schema" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventMeta": {
      "type": "object",
      "properties": {
        "parameters": {
          "type": "object",
          "properties": {
            "inputPattern": {
              "type": "string",
              "definition": "JMES path for transforming input element",
              "example": "{\"id\": productid}",
              "default": null
            },
            "outputPattern": {
              "type": "string",
              "definition": "JMES path for transforming buffered data (which is an array)",
              "example": "@[?id>0]",
              "default": null
            },
            "bufferId": {
              "type": "string",
              "definition": "Unique id for buffering similar payloads together",
              "example": "product_ids",
              "default": null
            },
            "bufferSize": {
              "type": "integer",
              "definition": "Max number of records to buffer",
              "example": 10,
              "default": null
            }
          }
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
`bufferSize` is defined at action level instead of handler level. This allows real-time changes for different buffer types without rebuilding the handler.
{% endhint %}

This action can improve performance for handlers that support batched requests, such as bulk writes or batched rule calculations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rierino.com/devops/api-event-and-process-flows/configuring-saga-steps/event-step/flow-actions/buffer-payloads.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
