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