Domanda

Mule 3.3.1 Community Edition.

I want to know if I'm missing some simple configuration pattern in Mule that will allow me to do the following general type of process. I want a message to come in from an inbound endpoint. I then want to call out to some other endpoint, such as a route-determination service, and, based upon the results of that outbound call, send the original message...unchanged...to a second outbound endpoint.

The call out to the route service changes the original message. Using constructs like wire-tap seem to pose sequencing problems. I can do it by copying all the headers and payload, but that's to tedious to code every time I need it and awkward to read. I can do it quite simply by writing a custom transformer that sets a result variable back on the message.

But, is there some simple, "pure-Mule-flow" solution for this? It seems somewhat analogous to the rationale for the http-proxy pattern construct, not having to copy all the inbound stuff to outbound manually.

È stato utile?

Soluzione

From my understanding it can be achived using mule's existing processors and transformers.

After reading you input from the inbound-endpoint

Step1: Use Mule Messag Enricher as explained in the below link. This way you can make a call to an outbound and set the return from the outbound into a flow or session variable keeping you payload undisturbed.

Mule Message Enricher

Step 2: Then you can use the flow/session variable which is set in the enricher to make a call to the second outbound.

An abstract flow of scenario loks like this.

<flow >
    <inbound-endpoint>       

     <enricher target="#[variable:myTempFlowVar]">
        <outbound call >
     </enricher>
    <choice>
        <when expression="#[flowVar['myTempFlowVar'] == 'Test']" >
            <outbound call 2>
        </when>
        <otherwise>
            <something else>
        </otherwise>
    </choice>
</flow>

Hope this helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top