# Kafka message filtering based on a field from message

**URL:** <https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053>\
**Category:** Kafka Connect\
**Created:** [11 October 2021 10:50 UTC](https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053 "2021-10-11T10:50:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashant4145](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@prashant4145](https://forum.confluent.io/u/prashant4145)\
**Post date:** [11 October 2021 10:50 UTC](https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053/1 "2021-10-11T10:50:39Z")

</div>

Hello there,

I am having a data into one topic and I have Sink Connector through which all messages get streamed to an application in the ecosystem. I need to filter and send messages only when one field is greater than 50. Message is in JSON format. For eg.

```auto
 {
	"value": {
		"value1": {

			"name":"abcd",
			"score": 133
		}
		
	}
}

```

if the score is greater than 50 then only I want to stream this message into sink connector.

@rmoff looking forward for your help.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rmoff](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/rmoff/32/3_2.png) [@rmoff](https://forum.confluent.io/u/rmoff)\
**Post date:** [11 October 2021 14:52 UTC](https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053/2 "2021-10-11T14:52:11Z")

</div>

Hi @prashant4145 ,

You can do this using Single Message Transform:

> **[🎄 Twelve Days of SMT 🎄 - Day 11: Predicate and Filter](https://rmoff.net/2020/12/22/twelve-days-of-smt-day-11-predicate-and-filter/#_filtering_based_on_the_contents_of_a_message)**

---

<div class="post-metadata">

**Author:** ![prashant4145](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@prashant4145](https://forum.confluent.io/u/prashant4145)\
**Post date:** [11 October 2021 15:54 UTC](https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053/3 "2021-10-11T15:54:17Z")

</div>

Thanks alot @rmoff for the help. It will really help alot.

---

<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:** [18 October 2021 15:54 UTC](https://forum.confluent.io/t/kafka-message-filtering-based-on-a-field-from-message/3053/4 "2021-10-18T15:54:19Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
