# Window of message batch

**URL:** https://forum.confluent.io/t/window-of-message-batch/4821
**Category:** ksqlDB
**Created:** [20 April 2022 03:07 UTC](https://forum.confluent.io/t/window-of-message-batch/4821 "2022-04-20T03:07:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)
#### Post date: [20 April 2022 03:07 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/1 "2022-04-20T03:07:10Z")

</div>

Hi there,

We can limit a stream for aggregation or stream-stream operations by window of time. Can we apply window of count of messages ?  
For example, I want to sum of cost every for every 500 records in real time.

Is it possible to provide batch.size as we provide in consumer config in ksqlDB?

Thanks.

---

<div class="post-metadata">

### Author: ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)
#### Post date: [20 April 2022 18:34 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/2 "2022-04-20T18:34:21Z")

</div>

ksqlDB does not support count-size windows – only time-size windows.

Maybe you can use an UDF to implement what you need?

> Is it possible to provide batch.size as we provide in consumer config in ksqlDB?

Yes, but it will only impact performance, not semantics. (cf [ksqlDB Server Configuration Parameter Reference - ksqlDB Documentation](https://docs.ksqldb.io/en/latest/reference/server-configuration/#ksqlstreamsproducercompressiontype) – you can set any client config this way)

---

<div class="post-metadata">

### Author: ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)
#### Post date: [21 April 2022 04:16 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/3 "2022-04-21T04:16:25Z")

</div>

Thanks for your response.

I am getting sales data in JSON format and I want to create array of every 500 messages for one of its fields.

This is what I want to achieve. Yes UDF can help me here, As per my understanding UDF needs to be programmed and converted into jar to add into plugin path if KsqlDB.

But I am using confluent cloud so where shall I put UDF’s jar to leverage it?

---

<div class="post-metadata">

### Author: ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)
#### Post date: [21 April 2022 15:27 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/4 "2022-04-21T15:27:10Z")

</div>

UDFs are not supported in Confluent Cloud right now ☹

---

<div class="post-metadata">

### Author: ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)
#### Post date: [21 April 2022 15:45 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/5 "2022-04-21T15:45:19Z")

</div>

So do I left with option of setting up self managed ksqldb pointing to confluent cloud and using UDF on that self managed ksqldb ?

---

<div class="post-metadata">

### Author: ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)
#### Post date: [21 April 2022 18:01 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/6 "2022-04-21T18:01:56Z")

</div>

Yes, that is for sure an option.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)
#### Post date: [20 May 2022 03:07 UTC](https://forum.confluent.io/t/window-of-message-batch/4821/7 "2022-05-20T03:07:16Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
