简体   繁体   中英

Getting this error org.mule.runtime.api.store.ObjectAlreadyExistsException: Object already exists for the key

I am getting this error on cloudhub "org.mule.runtime.api.store.ObjectAlreadyExistsException: Object already exists for the key".

I am using object store in my application. Where I am checking if the value is available in object store and then store it only if it is not available. I have set the option to "Fail if present" as false, still seeing this error.

How to resolve this?

I observed that this issue is coming only when I am using two workers in cloudhub.

Thanks in advance.

Edited: Using Object Store connector and mule 4.3. I am checking in object store using Contains if value exists. If it does then Retrieving the value else Storing it to OS.

Error在此处输入图像描述

Edit2: ObjectStore in Cloudhub: 在此处输入图像描述

The error message indicates that the application is using the default persistent object store. For sharing to multiple workers you should instead use the _defaultUserObjectStore which is in memory. Details are in: https://docs.mulesoft.com/object-store/osv2-faq#how-are-object-store-entries-divided-among-workers

You can try this approach!

Use a retrieve connector and wrap it in Try block. And define it own error handling strategy, in which use store connector in On Error Continue block. What it will do is, first it will try to retrieve the values stored in Object Store. If the keys will be present, respective values will be fetched. If the key is not present, an error will occur which will be handled by the error handler and will store the key to object store.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM