Search code examples
mulemule-studiomule-elmule-component

How to Intercept incoming call in Mule


Hi I am working with Mule Any Point platform i am using composite source which is listening from HTTP and JMS both. I want to identify the incoming call coming from HTTP or JMS and i want to print using the logger. How to do that ?

enter image description here


Solution

  • Try the following way of using logger inside your endpoints.

        <composite-source doc:name="Composite Source">
            <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP">
                <logger message="Request coming from HTTP endpoint."></logger>
                     <set-variable value="HTTP" variableName="myVar"></set-variable>
            </http:inbound-endpoint>
            <jms:inbound-endpoint doc:name="JMS" queue="in">
                <logger message="Request coming from JMS endpoint."></logger>
                     <set-variable value="JMS" variableName="myVar"></set-variable>
            </jms:inbound-endpoint>
        </composite-source>
    

    In the flow when you have to chekc a condition, you can use the flow variable "myVar" to check whether the message came from HTTP or JMS endpoint.

    Hope this helps.