Connector which discards empty messages

Userlevel 5
Badge +1

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


Best answer by lohith 10 June 2024, 11:46

View original

3 replies

Userlevel 6

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
Userlevel 1

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.


Userlevel 2

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:

<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:set attr="output.header:Empty" value="No" />
<arc:set attr="output.FilePath" value="[FilePath]" />
<arc:push item="output" />

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