简体   繁体   English

Mule-如何获取Java组件中当前组件的名称

[英]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? 在Mule中,如何获取Java组件中当前组件的名称?

For example, 例如,

I have a Java component like this in a mule flow :- 我在m子流中有一个像这样的Java组件:

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

where com.paris.ClimbTower is an implementation of Callable as below :- 其中com.paris.ClimbTower是Callable的实现,如下所示:

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. 我希望能够在ClimbTower类中获得组件名称(“ Climb”)以及可能的描述(“ Climb the Tower”)。 I looked around in the eventContext that is passed in, but couldn't see it anywhere. 我环顾了传入的eventContext,但在任何地方都看不到它。

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. Spring(加载Mule组件)会忽略doc名称空间中的属性,因此您无法直接访问这些值。

You could read these values by parsing the XML file directly though... 您可以通过直接解析XML文件来读取这些值,尽管...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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