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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[ { "id": "100", "name": "John Doe" }, { "id": "101", "name": "Jane Doe" }, { "id": "102", "name": "Jim Doe" }, { "id": "103", "name": "Jill Doe" }, { "id": "104", "name": "Jack Doe" }, { <mark style="background-color:#ea9629" class="has-inline-color has-dark-gray-color">"id": "100",</mark> "name": "John Doe COPY" } ] |
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 !