Book Image

EJB 3 Developer Guide

By : Michael Sikora
Book Image

EJB 3 Developer Guide

By: Michael Sikora

Overview of this book

Table of Contents (18 chapters)
EJB 3 Developer Guide
Credits
About the Author
About the Reviewers
Preface
Annotations and Their Corresponding Packages

MessageDrivenContext


An MDB may decide to implement the MessageDrivenContext interface. This interface is similar to the SessionContext interface provided for session beans, and provides information about an MDBs environment. We use the @Resource annotation to inject the context object into an MDB:

@Resource private MessageDrivenContext ctx;

There are a number of methods such as setRollbackOnly() and getRollbackOnly() which are identical to the corresponding SessionContext methods. These are used in the context of transactions, which we discuss later in this chapter.

Remaining MessageDrivenContext methods deal with Timer or Security aspects, which we cover in later chapters.