|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
A message service provider is responsible for providing a destination to which clients can send messages and from which message-driven beans (see "What is a Message-Driven Bean?") can receive messages for processing.
Using EJB 3.0, message-driven beans can only use a JMS message service provider.
Using EJB 2.1, message-driven beans can use a JMS or non-JMS service provider.
In either case, you can configure a message service provider by specifying message service provider classes or by using a J2EE Connector Architecture (J2CA) adapter.
For more information, see:
"Configuring an EJB 3.0 MDB to Use a Non-J2CA Message Service Provider"
"Configuring an EJB 2.1 MDB to Use a Non-J2CA Message Service Provider"
Using OC4J, you can use an MDB with the following types of message provider:
OracleAS JMS is a native Java JMS provider implementation that provides file-based persistence and is tightly integrated with OC4J. It is the default JMS provider included with OC4J. Figure 2-2 shows how a client sends an asynchronous request directly to the OracleAS JMS queue or topic that is located internally within OC4J. The MDB receives the message directly from OracleAS JMS.
Figure 2-2 Demonstration of an MDB Interacting with an OracleAS JMS Destination
If you do not access OracleAS JMS using the Oracle JMS Connector (see "J2EE Connector Architecture (J2CA) Adapter Message Provider"), be aware of the following restrictions:
no support for two-phase commit (2PC)
For more information, see
Oracle JMS (OJMS) is the JMS interface to the Oracle Database Streams Advanced Queueing (AQ) feature. Oracle AQ is the Oracle database-integrated message queuing feature, built on the Oracle Streams information integration infrastructure that you install and configure within an Oracle database (see Figure 2-3).
Figure 2-3 Demonstration of an MDB Interacting with an OJMS Destination
An MDB uses OJMS as follows:
The MDB opens a JMS connection to the database using a data source with a username and password. The data source represents the Oracle JMS provider and uses a JDBC driver to facilitate the JMS connection.
The MDB opens a JMS session over the JMS connection.
Any message for the MDB is routed to the onMessage method of the MDB.
At any time, the client can send a message to the Oracle JMS topic or queue on which MDBs are listening. The Oracle JMS topic or queue is located in the database.
Before using Oracle JMS, you must create the appropriate queue or table in the database.
|
Note: MDBs only work with certain versions of the Oracle database. See the certification matrix in the JMS chapter of the Oracle Containers for J2EE Services Guide for more information. |
For more information, see:
"Configuring an EJB 3.0 MDB to Use a Non-J2CA Message Service Provider"
"Configuring an EJB 2.1 MDB to Use a Non-J2CA Message Service Provider"
Oracle Streams Advanced Queuing User's Guide and Reference
"Java Message Service (JMS)" in the Oracle Containers for J2EE Services Guide
OC4J provides a JMS Connector: a generic Java Message Service (JMS) J2CA resource adapter that integrates OC4J with OracleAS JMS and OJMS message service providers, as well as non-Oracle JMS providers as Table 2-7 shows.
Table 2-7 Oracle JMS Connector Support for JMS Message Service Providers
| JMS Provider | Version |
|---|---|
|
OracleAS JMS |
all |
|
OJMS |
all |
|
IBM WebSphere MQ-based JMS |
Server Version 5.3 and 6.0 |
|
TIBCO Enterprise for JMS |
3.1.0 |
|
SonicMQ |
6.0 |
You can use other J2CA-compliant adapters with OC4J to integrate with other types of enterprise information systems (EIS).
|
Note: Oracle recommends that newer JMS applications be deployed using the J2CA 1.5 Resource Adapter mandated by the J2EE 1.4 standard. |
Using a J2CA adapter, you can access other JMS and non-JMS message service providers as Figure 2-4 shows. In this architecture, the client does not access a queue or topic directly. Instead, to send a message to an EIS by way of a J2CA adapter, you:
Obtain a javax.resource.cci.ConnectionFactory.
If the EIS is a JMS message service provider, there will likely be connection factory choices for queue or topic. For example, the Oracle JMS Connector offers a QueueConnectionFactory and a TopicConnectionFactory.
Use the factory to obtain a javax.resource.cci.Connection.
Use the connection to obtain a javax.resource.cci.Interaction.
Configure the interaction and use Interaction method execute to send the message.
Figure 2-4 Demonstration of an MDB Interacting with a J2CA JMS Destination
From the perspective of OC4J, J2CA is only used as a means of accessing a message service provider for use with message-driven beans.
For more information, see:
"Configuring an EJB 3.0 MDB to Use a J2CA Message Service Provider"
"Configuring an EJB 2.1 MDB to Use a J2CA Message Service Provider"
"Introducing Oracle JMS Support and Generic JMS Resource Adapter" in the Oracle Containers for J2EE Resource Adapter Administrator's Guide
"Overview: Administering Resource Adapters" in the Oracle Containers for J2EE Resource Adapter Administrator's Guide
|
Note: For a complete code example of configuring a J2CA message service provider resource adapter and MDB application, seehttp://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-gjra-with-oracleasjms/doc/how-to-gjra-with-oracleasjms.html.
|