# Connector which discards empty messages

**URL:** <https://community.cdata.com/t/connector-which-discards-empty-messages/752>\
**Category:** CData Arc\
**Tags:** question\
**Created:** [June 7, 2024, 4:29pm UTC](https://community.cdata.com/t/connector-which-discards-empty-messages/752 "2024-06-07T16:29:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [June 7, 2024, 4:29pm UTC](https://community.cdata.com/t/connector-which-discards-empty-messages/752/1 "2024-06-07T16:29:04Z")

</div>

Is there a way to discard an empty message?

I have a misbehaving HTTP endpoint which is causing me to get intermittent empty messages going through the flow.

These end up clogging up the logs.

It would be good if I could detect empty messages in the flow and discard them before they affect anything downstream

---

<div class="post-metadata">

**Author:** ![James\_B](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/james_b/32/1688_2.png) [@James\_B](https://community.cdata.com/u/James_B)\
**Post date:** [June 7, 2024, 5:34pm UTC](https://community.cdata.com/t/connector-which-discards-empty-messages/752/2 "2024-06-07T17:34:38Z")

</div>

There are generally two approaches here:​​​​​​

1. If you have a connector that produces files that you don’t do any processing with, you can connect that connector to a Script connector, and if you don’t create any code in that Script, it will dispose of that file (technically, it’s processing them but doing nothing).
2. If you’re talking about the REST connector in particular, in later releases of CData Arc, you can set the Advanced-\> **Output Behavior** to None to not output a response to the Receive folder

---

<div class="post-metadata">

**Author:** ![Piet\_Potappel](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@Piet\_Potappel](https://community.cdata.com/u/Piet_Potappel)\
**Post date:** [June 9, 2024, 7:47am UTC](https://community.cdata.com/t/connector-which-discards-empty-messages/752/3 "2024-06-09T07:47:51Z")

</div>

I think Russell needs a script that checks the file length.  
If length \> 0 continue, if length = 0 ignore and/or send to dead-end-connector.

---

<div class="post-metadata">

**Author:** ![lohith](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lohith/32/1848_2.png) [@lohith](https://community.cdata.com/u/lohith)\
**Post date:** [June 10, 2024, 9:46am UTC](https://community.cdata.com/t/connector-which-discards-empty-messages/752/4 "2024-06-10T09:46:05Z")

</div>

If the REST connector produces an empty file without any contents, you can use the `fileread()` operation to check if the file contains content or not with the following script. You can then branch them appropriately using a branch connector based on the header:

```auto
<arc:set attr="file.file" value="[filepath]" /><arc:call op="fileRead" in="file" out="result" > <arc:if exp="[result.file:data | equals('')]"> <arc:set attr="output.header:Empty" value="Yes" /> <arc:else> <arc:set attr="output.header:Empty" value="No" /> </arc:else> </arc:if></arc:call><arc:set attr="output.FilePath" value="[FilePath]" /><arc:push item="output" />

```

Additionally, you can write the script based on file size as well.
