Escolar Documentos
Profissional Documentos
Cultura Documentos
Contract
5.1 Overview
5.2 Goals
5.3 Client View of a MDB
5.4 Protocol Between a MDB Instance and its Container
5.4.1 Required MessageDrivenBean Metadata
5.4.2 The Required Message Listener Interface
5.4.3 Dependency Injection
5.4.4 The MessageDrivenContext Interface
5.4.5 MDB Lifecycle Callback Interceptor Methods
5.4.6 The Optional MessageDrivenBean Interface
5.4.7 Timeout Callbacks
5.4.8 MDB Creation
5.4.9 Message Listener Interceptor Methods for Message-Driven Beans
5.4.10 Serializing Message-Driven Bean Methods
5.4.11 Concurrency of Message Processing
5.4.12 Transaction Context of Message-Driven Bean Methods
5.4.13 Security Context of Message-Driven Bean Methods
5.4.14 Activation Configuration Properties
5.4.15 Message Acknowledgment for JMS Message-Driven Beans
5.4.16 Message Selectors for JMS Message-Driven Beans
5.4.17 Association of a Message-Driven Bean with a Destination or
Endpoint
5.4.17.1 JMS MDBs
5.4.18 Dealing with Exceptions
5.4.19 Missed PreDestroy Callbacks
5.4.20 Replying to a JMS Message
5.5 MDB State Diagram
5.5.1 Operations Allowed in the Methods of a MDB Class
5.6 The Responsibilities of the Bean Provider
5.6.1 Classes and Interfaces
5.6.2 MDB Class
5.6.3 MDB Superclasses
5.6.4 Message Listener Method
5.6.5 Lifecycle Callback Interceptor Methods
5.7 The Responsibilities of the Container Provider
5.7.1 Generation of Implementation Classes
5.7.2 Deployment of JMS Message-Driven Beans
5.7.3 Request/Response Messaging Types
5.7.4 Non-reentrant Instances
5.2 Goals
O objetivo do modelo de MDB fazer com que o desenvolvimento de um EB
que so invocados de forma assincrona para manipular o processamento de
msgs recebidas sejam to simples como desenvolver a mesma
funcionalidade em qualquer outro msg listener.
Um outro objetivo do modelo de MDB permitir o processamento
simultneo de um fluxo de msgs por meio de pooling fornecido pelo
container de instncias MDB.
A clients JNDI name space pode ser configurado para incluir os destinos
ou pontos finais de MDBs instalados em vrios containers EJB localizados em
vrias mquinas em uma rede. Os locais reais de um EB e container EJB so,
em geral, transparente para o cliente usando o EB.
As referncias aos destinos de msgs pode ser injetado, ou eles podem ser
consultados no namespace JNDI do cliente.
Por exemplo, a referncia para a fila para um MDB JMS pode ser injetado
como segue.
@Resource Queue stockInfo Queue;
Alternatively, the queue for the StockInfo JMS message-driven bean might
be located using the following code segment:
Context initialContext = new InitialContext();
Queue stockInfoQueue
=(javax.jms.Queue)initialContext.lookup(java:comp/env/jms/stockInfoQueue);
The remainder of this section describes the message-driven bean life cycle
in detail and the protocol between the message-driven bean and its
container.
Sob o EJB 3.x API, a classe de bean pode, opcionalmente, definir um mtodo
PreDestroy callback para notificao de remoo do continer da instncia
de bean.
For example:
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName=messageSelector,
propertyValue=JMSType = car AND color = blue and weight > 2500)})
<activation-config>
<activation-config-property>
<activation-config-property-name>messageSelector</activationcon-fig-property-name>