简体   繁体   English

Mule缓存-内存中的群集-反序列化问题

[英]Mule Cache - Cluster In Memory - deserialization issue

My Mule 3.9 application exposes a rest end point. 我的Mule 3.9应用程序公开了一个休息终点。 Application is clustered and on-prem managed through Runtime Manager 通过运行时管理器对应用程序进行集群和本地管理

Condition is: the end point which kicks off the batch process should be singleton meaning only 1 process should be running on the entire cluster. 条件是:开始批处理过程的端点应该是单例,这意味着整个集群上只能运行1个进程。 If a rest endpoint is invoked again, it should result into http status 409 如果再次调用其他端点,则它将进入http状态409

For this use case, I have utilized Mule Caching - Clustered - In Memory version with below configuration 对于此用例,我使用了具有以下配置的Mule Caching-Clustered-In Memory版本

<ee:object-store-caching-strategy name="caching_strategy" doc:name="caching_strategy" keyGenerationExpression="some_key" synchronized="false" entryTTL="14400000" persistent="false" />

My flow looks like below - 我的流程如下所示-

<flow name="some-flow" doc:description="some-flow">
   <message-properties-transformer scope="invocation" doc:name="Intialize Message Properties" mimeType="application/java">
        <add-message-property key="messageId" value="#[message.rootId]"/>
   </message-properties-transformer>

<ee:cache doc:name="inititiation" cachingStrategy-ref="caching_strategy" >
    <logger message="process cache miss" level="INFO" doc:name="process cache miss"/>
    <set-payload doc:name="initialize cache map" value="#[{'id' : flowVars.messageId}]" />
</ee:cache>

<choice doc:name="Is process already running ?" >
    <when expression="#[payload.id == flowVars.messageId]">
        <logger message="New process started" level="INFO" />
    </when>
    <otherwise>
        <logger message="Process is already running" level="WARN" />
    </otherwise>
</choice>
</flow>

As you can see, I am putting java.util.HashMap with 1 key-value pair in cache and checking if it already exists or not 如您所见,我将具有1个键值对的java.util.HashMap放入缓存中,并检查它是否已经存在

    <set-payload doc:name="initialize cache map" value="#[{'id' : flowVars.messageId}]" />

Actual functionality works great in the cluster and serves the purpose ! 实际功能在集群中很好用,并且达到了目的!

HOWEVER application logs are full of below **WARN** statements 但是,应用程序日志中充满了以下**WARN**语句

org.mule.util.store.MonitoredObjectStoreWrapper - 
Running expirty on org.mule.util.store.ObjectStorePartition@4648ce75 threw java.lang.IllegalArgumentException: 
Cannot deserialize with a null classloader:
Cannot deserialize with a null classloader

I am not sure what is issue? 我不确定是什么问题? The object which is in the cache is java.util.HashMap which is serializable and only key-value pair is of String. 缓存中的对象是可序列化的java.util.HashMap,只有键值对是String。

I sense some class loader issue, but could not bring myself close to it. 我感觉到一些类加载器问题,但无法解决这个问题。

Does anybody have any clue? 有人有任何线索吗?

Thanks Vikas 谢谢维卡斯

Had my hands on the ground and managed to resolve the issue with below configuration - 我动手了,并设法通过以下配置解决了该问题-

<ee:object-store-caching-strategy name="caching_strategy" doc:name="caching_strategy" keyGenerationExpression="some_key" synchronized="false" >

    <!-- this is because my flow eturns different message than cache"
    <ee:serializable-event-copy-strategy/>

    <!-- manged store without persistance -->
    <managed-store storeName="MyTaskInMemoryStoreForClusteredCaching" 
               maxEntries="1" entryTTL="14400000" 
               expirationInterval="3660000" persistent="false"/>


</ee:object-store-caching-strategy>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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