1

i want add some extra information on incomming Pojo, i have used message enricher in mule and do that, here is my full flow. I am using subflow to get the payload and select some values in DB and set that value in same pojo and returning, while in target i am setting as payload but i am getting error like this "An Expression Enricher for "payload" is not registered with Mule."

here is mu flow

<enricher doc:name="Message Enricher">
        <core:flow-ref name="flows1Flow1" doc:name="Flow Reference"/>
        <enrich source="#[groovy:payload]" target="#[payload]"/>            

<logger message="AFTER Enrich: #[payload]" level="INFO" doc:name="Logger"/>
    <component class="com.enrich.AfterEnricher" doc:name="Java"/>


 <sub-flow name="flows1Flow1" doc:name="flows1Flow1">
    <component class="com.enrich.MessageEnrichPattern" doc:name="Java"/>
    <jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="selectData" connector-ref="jdbcConnector" doc:name="Database (JDBC)">
        <jdbc:query key="selectData" value="SELECT Username, Password, ModuleId from Credentials where ModuleId=#[map-payload:moduleId]"/>
    </jdbc:outbound-endpoint>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    <component class="com.enrich.ReceiveMessageEnrichPattern" doc:name="Java"/>
</sub-flow>

here ReceiveMessageEnrichPattern returing

Credential credential = new Credential();
    credential.setUname(hashMap.get("USERNAME").toString());
    credential.setPwd(hashMap.get("PPPP").toString());
    credential.setMid(hashMap.get("MODULEID").toString());
    return credential;

but in after enrich component i am getting exception. Please help me how can enrich my incoming pojo with extra info can add.

4

1 回答 1

2

根据docs,Mule 目前只支持两个富集目标:

  • 流量变量,
  • 消息头。

为了实现您的目标,您需要:

  • 将浓缩器结果(凭据对象)存储在流变量中,
  • 使用自定义转换器将流变量中的 Credential 对象中的值复制到主流中的 POJO 有效负载。
于 2012-05-28T22:57:06.930 回答