nerdexam
Oracle

1Z0-900 · Question #5

What is true about Message-Driven Beans (MDBs)?

The correct answer is A. MDBs can participate in transactions. MDBs can participate in transactions (A) because the EJB container can automatically begin and commit/rollback a JMS transaction around the onMessage() method, ensuring message processing is atomic and reliable - this is a core feature of the EJB specification. Why the…

Use Java Message Service API

Question

What is true about Message-Driven Beans (MDBs)?

Options

  • AMDBs can participate in transactions.
  • BMDBs are invoked synchronously.
  • CEach MDBs can process messages only from a single client.
  • DMDBs retain data caches between client calls.

How the community answered

(33 responses)
  • A
    88% (29)
  • B
    3% (1)
  • C
    3% (1)
  • D
    6% (2)

Explanation

MDBs can participate in transactions (A) because the EJB container can automatically begin and commit/rollback a JMS transaction around the onMessage() method, ensuring message processing is atomic and reliable - this is a core feature of the EJB specification.

Why the distractors are wrong:

  • B (synchronous) - MDBs are inherently asynchronous. They listen on a JMS queue or topic and are triggered when a message arrives; the sender never waits for a response.
  • C (single client) - MDBs are not bound to a single client. Any producer can send messages to the destination the MDB listens on; MDBs are fully anonymous from the sender's perspective.
  • D (retain data between calls) - MDBs are stateless. Like stateless session beans, they hold no conversational state between invocations; each onMessage() call is independent.

Memory tip: Think of an MDB as a stateless session bean that listens instead of waits - it shares the stateless, transaction-capable nature of SLSBs, but fires asynchronously from a JMS destination rather than being called directly by a client.

Topics

#Message-Driven Beans#JMS messaging#EJB transactions#asynchronous processing

Community Discussion

No community discussion yet for this question.

Full 1Z0-900 Practice