简体   繁体   中英

Mule - How to get the name of the current component in a Java component

In Mule, how can I get the name of the current component in a java component?

For example,

I have a Java component like this in a mule flow :-

<component class="com.paris.ClimbTower" doc:name="Climb" doc:description="Climb the Tower"/>

where com.paris.ClimbTower is an implementation of Callable as below :-

public class ClimbTower implements Callable {
    @Override
    public Object onCall(MuleEventContext eventContext) throws Exception {
        ?????
    }

I would like to be able to get the component name ("Climb") and possibly the description ("Climb the Tower") in the ClimbTower class. I looked around in the eventContext that is passed in, but couldn't see it anywhere.

Thanks, in advance !!

The attributes in the doc namespace are ignored by Spring (which loads the Mule components) thus you can't get access to these values directly.

You could read these values by parsing the XML file directly though...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM