[英]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".我在 cloudhub 上收到此错误“org.mule.runtime.api.store.ObjectAlreadyExistsException: Object 已存在密钥”。
I am using object store in my application.我在我的应用程序中使用 object 存储。 Where I am checking if the value is available in object store and then store it only if it is not available.我在哪里检查该值是否在 object 存储中可用,然后仅在它不可用时存储它。 I have set the option to "Fail if present" as false, still seeing this error.我已将“如果存在则失败”选项设置为 false,仍然看到此错误。
How to resolve this?如何解决这个问题?
I observed that this issue is coming only when I am using two workers in cloudhub.我观察到只有当我在 cloudhub 中使用两个工作人员时才会出现这个问题。
Thanks in advance.提前致谢。
Edited: Using Object Store connector and mule 4.3.编辑:使用 Object Store 连接器和 mule 4.3。 I am checking in object store using Contains if value exists.如果值存在,我正在使用包含检查 object 存储。 If it does then Retrieving the value else Storing it to OS.如果确实如此,则检索该值,否则将其存储到操作系统。
Edit2: ObjectStore in Cloudhub: Edit2:Cloudhub 中的 ObjectStore:
The error message indicates that the application is using the default persistent object store.错误消息表明应用程序正在使用默认的持久 object 存储。 For sharing to multiple workers you should instead use the _defaultUserObjectStore
which is in memory.要与多个工作人员共享,您应该改用 memory 中的_defaultUserObjectStore
。 Details are in: https://docs.mulesoft.com/object-store/osv2-faq#how-are-object-store-entries-divided-among-workers详细信息在: https://docs.mulesoft.com/object-store/osv2-faq#how-are-object-store-entries-divided-among-workers
Use a retrieve connector and wrap it in Try block.使用检索连接器并将其包装在 Try 块中。 And define it own error handling strategy, in which use store connector in On Error Continue block.并定义它自己的错误处理策略,在 On Error Continue 块中使用 store 连接器。 What it will do is, first it will try to retrieve the values stored in Object Store.它将首先尝试检索存储在 Object 存储中的值。 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.如果密钥不存在,则会发生错误,该错误将由错误处理程序处理并将密钥存储到 object 存储区。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.