问题描述
我想知道是否可以在jca适配器中获取对ejb3本地业务接口的引用?
I'd like to know whether it is possible to get a reference to the ejb3 local business interfaces inside the jca adapter?
资源适配器和ejb .jar
被打包到相同的 .ear
。应用程序在带有ejb3要素包的WebSphere AS 6.1下运行。
Resource adapter and ejb .jar
are packed into the same .ear
. Application is running under WebSphere AS 6.1 with ejb3 featurepack.
我试图使用 ejblocal:< full_class_name_of_local_interface>
作为JNDI名称,但没有成功。
I have tried to use ejblocal:<full_class_name_of_local_interface>
as JNDI name, but without success.
推荐答案
你要做的事情可能是概念错误 。 JCA适配器不应该依赖于EJB - JCA适配器不应该查找EJB。
What you are trying to do is probably conceptually wrong. JCA adapter should not depend on EJB -- a JCA adapter should not lookup an EJB.
但JCA适配器适用于入站和出站连接。使JCA连接器与EJB(入站连接)通信的正确方法是通过消息驱动bean( MDB )进行通信。
But JCA adapters work for inbound and outbound connectivity though. The right way to have a JCA connector communicate with an EJB (inbound connectivity), it through message driven bean (MDB).
- JCA适配器定义了一个用于通信的接口。
- 然后,自定义MDB可以实现此接口,并可以从适配器接收入站请求。
我同意在这种情况下,消息驱动的bean这个名称有点误导。自定义MDB非常类似于EJB并接收来自JCA连接器的调用。它不必与消息或异步处理相关。如果你想自定义MDB然后可以查找或使用其他EJB注入来委派处理。
I agree that in this case the name "message-driven bean" is a bit misleading. The custom MDB is really like an EJB and receive calls from the JCA connector. It's not necessary related to message nor asynchronous processing. If you want the custom MDB can then lookup or have other EJB inject to delegate the processing.
要查看的最佳文档是它给出了入站和出站连接的示例。相应的代码可以在SDK附带的J2EE示例中找到。
The best doc to look at is "Creating Resource Adapter with J2EE Connector Architecture 1.5". It gives an example for inbound and outbound connectivity. The corresponding code can be found in the J2EE samples which come with the SDK.
这篇关于获取对JCA适配器内的EJB3本地业务接口的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!