• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

EJB 2.0 only supported JMS messages in Message-Driven Beans. If an enterprise system needed to receive non-JMS messages (like EbXML, legacy system messages), it couldn’t use MDBs. There was no standard way to plug in different message types.

Core Idea

From EJB 2.1+, MDBs can consume any message type (not just JMS) by using J2EE Connector Architecture 1.5 (JCA) resource adapters. These act as pluggable message providers that handle message inflow from any enterprise system.

How It Works

  1. MDB implements a message listener interface specific to the message type (e.g., javax.jms.MessageListener for JMS, or custom com.xyz.messaging.EbXMLMessageListener for EbXML)
  2. A Resource Adapter (based on JCA 1.5) is written for the specific message type
  3. The resource adapter uses JCA message inflow contracts to deliver messages to MDB endpoints
  4. Resource adapter is plugged into any J2EE-compliant application server (standard component)
  5. Container delegates message delivery to the resource adapter, which calls onMessage() on the MDB

Example: EbXML Messages

  • JAX-RPC doesn’t support EbXML or asynchronous messaging
  • Write a resource adapter with EbXMLMessageListener interface
  • MDB implements this interface → can now receive EbXML messages
  • Resource adapter handles the protocol; MDB just processes the message

Visual Explanation

G ExtSys Enterprise System (EbXML, Legacy, etc.) RA Resource Adapter (JCA 1.5) ExtSys->RA non-JMS message Container EJB Container RA->Container JCA message inflow MDB MDB implements custom MessageListener Container->MDB onMessage()

Key Properties

  • EJB 2.0: MDB only supported JMS messages
  • EJB 2.1+: Any message type via JCA resource adapters
  • Resource adapters are standard J2EE components — pluggable into any compliant server
  • MDB uses different listener interfaces for different message types
  • Decouples MDB from specific messaging protocols

Connections

  • Built from: MDB — pluggable providers extend what MDB can consume
  • Built from: MOM — JCA can integrate non-JMS MOM systems
  • Related: JMS — JMS is one (default) type of message provider for MDBs
  • Related: EJB Container — container manages MDB and resource adapter interaction
  • Contrasts with: Session Bean — session beans don’t use message listeners

Edge Cases & Gotchas

  • EJB 2.0 MDBs cannot consume non-JMS messages (must upgrade to 2.1+)
  • Writing custom resource adapters requires deep knowledge of JCA 1.5 specification
  • JAX-RPC only supports SOAP 1.1 and is not asynchronous — JCA is the solution for async non-SOAP
  • Each message type needs its own listener interface implemented by the MDB