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

15.3.2. Connecting via JCA


You can use JCA Message Inflow as an ESB Gateway. To enable a gateway for a service, you must first implement an end-point class that implements the org.jboss.soa.esb.listeners.jca.InflowGateway class:
public interface InflowGateway
{
  public void setServiceInvoker(ServiceInvoker invoker);
}
Copy to Clipboard Toggle word wrap
The end-point class must either have a default constructor or a constructor that takes a ConfigTree parameter. This Java class must also implement the messaging type of the JCA adapter you are binding to. Here's a simple endpoint class example that hooks up to a JMS adapter:
public class JmsEndpoint implements InflowGateway, MessageListener
{
  private ServiceInvoker service;
  private PackageJmsMessageContents transformer = new PackageJmsMessageContents();

  public void setServiceInvoker(ServiceInvoker invoker)
  {
    this.service = invoker;
  }

  public void onMessage(Message message)
  {
    try
    {
      org.jboss.soa.esb.message.Message esbMessage = transformer.process(message);
      service.deliverAsync(esbMessage);
    }
    catch (Exception e)
    {
      throw new RuntimeException(e);
    }
  }
}
Copy to Clipboard Toggle word wrap
One instance of the JmsEndpoint class will be created per gateway defined for this class. This is not like a message-driven bean that is pooled. Only one instance of the class will service each and every incoming message, so you must write thread safe code.
At configuration time, the ESB creates a ServiceInvoker and invokes the setServiceInvoker method on the end-point class. The ESB then activates the JCA end-point and the end-point class instance is ready to receive messages. In the JmsEndpoint example, the instance receives a JMS message and converts into an ESB message. It then uses the ServiceInvoker instance to invoke on the target service.

Note

The JMS end-point class is provided under org.jboss.soa.esb.listeners.jca.JmsEndpoint. You can use this class over and over again with any JMS JCA inflow adapters.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat