![Red Hat Application Server Скачать руководство пользователя страница 206](http://html.mh-extra.com/html/red-hat/application-server/application-server_manual_1427406206.webp)
198
Chapter 26. JMS User’s Guide
You can find a sample JMS application in $JONAS_ROOT/examples/src/jms/; it is described in Sec-
tion 26.6
A JMS EJB Example
.
26.2.1. Accessing the Connection Factory
The EJB specification introduces the concept of
resource manager connection factory references
.
This concept also appears in the J2EE v1.4 specification. It is used to create connections to a resource
manager. To date, three types of
resource manager connection factories
are considered:
•
DataSource objects (
javax.sql.DataSource
) represent connection factories for JDBC connec-
tion objects.
•
JMS connection factories. The connection factories for JMS connection objects are:
•
javax.jms.ConnectionFactory
•
javax.jms.QueueConnectionFactory
•
javax.jms.TopicConnectionFactory
.
•
Java Mail connection factories. The connection factories for Java Mail connection objects are
javax.mail.Session
or
javax.mail.internet.MimePartDataSource
.
The connection factories of interest here are the second type, which should be used to get JMS con-
nection factories.
Note that starting with JMS 1.1, it is recommended that you use only the
javax.jms.ConnectionFactory
(rather than
javax.jms.QueueConnectionFactory
or
javax.jms.TopicConnectionFactory
). However, the JMS 1.1 implementation is fully
backwards-compatible and existing applications will work as-is.
The standard deployment descriptor should contain the following
resource-ref
element:
È
resource-ref
É
È
res-ref-name
É
jms/conFact
È
/res-ref-name
É
È
res-type
É
javax.jms.ConnectionFactory
È
/res-type
É
È
res-auth
É
Container
È
/res-auth
É
È
/resource-ref
É
This means that the programmer will have access to a
ConnectionFactory
object using the JNDI
name
java:comp/env/jms/conFact
. The source code for obtaining the factory object is the fol-
lowing:
ConnectionFactory qcf = (ConnectionFactory)
ctx.lookup("java:comp/env/jms/conFact");
The mapping to the actual JNDI name of the connection factory (as assigned by the JMS provider
administration tool),
CF
in the example, is defined in the JOnAS-specific deployment descriptor with
the following element:
È
jonas-resource
É
È
res-ref-name
É
jms/conFact
È
/res-ref-name
É
È
jndi-name
É
CF
È
/jndi-name
É
È
/jonas-resource
É
Содержание Application Server
Страница 1: ...Red Hat Application Server JOnAS User Guide ...
Страница 8: ......
Страница 22: ...14 Chapter 1 Java Open Application Server JOnAS a J2EE Platform ...
Страница 58: ...50 Chapter 3 JOnAS Configuration ...
Страница 66: ...58 Chapter 5 JOnAS Class Loader Hierarchy ...
Страница 78: ...70 Chapter 6 JOnAS Command Reference ...
Страница 80: ......
Страница 86: ...78 Chapter 7 Developing Session Beans ...
Страница 136: ...128 Chapter 9 Developing Message Driven Beans ...
Страница 142: ...134 Chapter 10 Defining the Deployment Descriptor ...
Страница 148: ...140 Chapter 11 Transactional Behavior of EJB Applications ...
Страница 158: ...150 Chapter 14 EJB Packaging ...
Страница 162: ...154 Chapter 15 Application Deployment and Installation Guide ...
Страница 164: ......
Страница 176: ...168 Chapter 18 WAR Packaging ...
Страница 178: ......
Страница 184: ...176 Chapter 20 Defining the Client Deployment Descriptor ...
Страница 186: ...178 Chapter 21 Client Packaging ...
Страница 188: ......
Страница 192: ...184 Chapter 23 EAR Packaging ...
Страница 194: ......
Страница 200: ...192 Chapter 24 JOnAS Services ...
Страница 204: ...196 Chapter 25 JOnAS and the Connector Architecture ...
Страница 222: ...214 Chapter 27 Ant EJB Tasks Using EJB JAR ...
Страница 234: ...226 Chapter 29 Web Services with JOnAS ...
Страница 236: ......
Страница 260: ...252 Chapter 34 How to use Axis in JOnAS ...
Страница 270: ...262 Chapter 36 Web Service Interoperability between JOnAS and BEA WebLogic ...
Страница 296: ......