Dynamic variable in Flow in MULE?

594 views Asked by At

I have a Flow in MULE which contains a HTTP inbound and component class like below :

<flow name="MetaService">
    <http:inbound-endpoint address="http://localhost:8000/jcore/meta/user"  
transformer-refs="HttpParams" responseTransformer-refs="JavaObjectToJson">
    </http:inbound-endpoint>
    <component class = "com.jcore.Meta" />
</flow>

Now if i have to accept request for another URL, like "localhost:8000/jcore/meta/user2", i have to create another flow..!!

Is there any option in MULE like "localhost:8000/jcore/meta/{variable}" , where in i can read that variable and call the appropriate component class according to that..??

1

There are 1 answers

0
David Dossot On BEST ANSWER
  • Consider creating JAX-RS annotated resources and the Jersey Module so all this URL-based dispatching will be done automatically for you.
  • Otherwise, just bind MetaService to "http://localhost:8000/jcore/meta", then have a choice router that looks at the actual request path ("/jcore/meta/user" or "/jcore/meta/user2") and dispatch to the right destination accordingly.