此内容没有您所选择的语言版本。

14.10. Configuring a Java Bean Action


The Java Bean Action class must implement the org.jboss.soa.esb.actions.BeanConfiguredAction marker interface in order to make the action Bean populate automatically. Here is some sample code:
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.actions.BeanConfiguredAction;

public class PrintMessage implements BeanConfiguredAction {
  private String information;
  private Integer repeatCount;
  public void setInformation(String information) {
    this.information = information;
  }
  public void setRepeatCount(Integer repeatCount) {
    this.repeatCount = repeatCount;
  }
  public Message process(Message message) {
    for (int i=0; i < repeatCount; i++) {
      System.out.println(information);
    }
    return message;
  }
}
Copy to Clipboard Toggle word wrap

Note

The Integer parameter in the setRepeatCount() method is automatically converted from the String representation specified in the XML.
The BeanConfiguredAction method of loading properties is a good choice for actions that take simple arguments, while the ConfigTree method is a better option in situations when one needs to deal with the XML representation directly.

Important

These actions do not support the lifecycle methods. Rather they will be instantiated for every message passing through the action pipeline and will always have their process methods invoked using reflection.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat