[Yandex Cloud documentation](../../../index.md) > [Yandex Serverless Containers](../../index.md) > [Concepts](../index.md) > [Trigger](index.md) > Trigger for Data Streams

# Trigger for Data Streams that invokes a Serverless Containers container

 [Trigger](index.md) for Data Streams calls a Serverless Containers [container](../container.md) when data is sent to a [stream](../../../data-streams/concepts/glossary.md#stream-concepts). 

A trigger for Data Streams needs [service accounts](../../../iam/concepts/users/service-accounts.md) to manage a stream and invoke a container. You can use the same service account for both operations.

For more information about creating a trigger for Data Streams, see [Creating a trigger for Data Streams that invokes a container from Serverless Containers](../../operations/data-streams-trigger-create.md).

## Message batching {#batching}

Batching settings allow you to send multiple messages to a container at the same time. They set a top limit on the message batch size and accumulation time. For example, if the message batch size is `3`, the container can receive batches of one to three messages.

## Roles required for the proper operation of a trigger for Data Streams {#roles}

* To create a trigger, you need a permission for the service account under which the trigger runs the operation. This permission comes with the [iam.serviceAccounts.user](../../../iam/concepts/access-control/roles.md#sa-user) and [editor](../../../iam/concepts/access-control/roles.md#editor) roles or higher.
* For the trigger to fire, service accounts need the following roles:
    * `serverless.containers.invoker` for the container the trigger invokes.
    * `yds.admin` for the stream that invokes the trigger when data is sent there.

## Format of the message from the trigger for Data Streams {#format}

The trigger for Data Streams receives and sends messages in [JSON](https://enwikipedia.org/wiki/JSON) format only.

Once the trigger fires, it will send a message with the `messages` array to the container:

```json
{
   "messages":[
      {
         "key1":"value1"
      },
      {
         "key2":"value2"
      }
   ]
}
```


## See also {#see-also}

* [Trigger for Data Streams that invokes a Cloud Functions function](../../../functions/concepts/trigger/data-streams-trigger.md)
* [Trigger for Data Streams that sends messages to WebSocket connections](../../../api-gateway/concepts/trigger/data-streams-trigger.md)