Boomi: Check if already in cache before adding

I found myself with the error

Found more than 1 document in the document cache (index: dummyUserIndex, keys: [id (Root/Object/id) = 100])

and figured I just need to add a Decision Shape and check if the key (object) is already in the cache and then I would not add it. BUT it turned out to more complicated than I first thought.

Here is my first attempt…

Seems reasonable … I have 2 steps, first I check if the object is in the cache and if it is I don’t do anything, and if it is not I go and fetch and add it to the cache.

Problem is that the json that comes in is a list of objects

A deliberate duplicate to show the point I am making

Now what we end up having is 6 json objects, when Boomi processes that , it will process ALL of them through the Decision Shape (“Already in cache?”) above before it does anything else, and hence NONE of them are in the cache.

So when we execute it, it looks like this

Except for the error we get, we can see a peculiar thing, we never get a cache hit, instead we get all cache misses !!!

I ended up having to add a Flow Control shape

And select “Run each document individually”, see below

Now it runs fine …

We can see that we have a cache hit ! this is great, and we also did not get an error 🙂

Over and out !

Leave a Reply

Your email address will not be published. Required fields are marked *