繁体   English   中英

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

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

我的Mule 3.9应用程序公开了一个休息终点。 通过运行时管理器对应用程序进行集群和本地管理

条件是:开始批处理过程的端点应该是单例,这意味着整个集群上只能运行1个进程。 如果再次调用其他端点,则它将进入http状态409

对于此用例,我使用了具有以下配置的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" />

我的流程如下所示-

<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>

如您所见,我将具有1个键值对的java.util.HashMap放入缓存中,并检查它是否已经存在

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

实际功能在集群中很好用,并且达到了目的!

但是,应用程序日志中充满了以下**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

我不确定是什么问题? 缓存中的对象是可序列化的java.util.HashMap,只有键值对是String。

我感觉到一些类加载器问题,但无法解决这个问题。

有人有任何线索吗?

谢谢维卡斯

我动手了,并设法通过以下配置解决了该问题-

<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