web server - Borland Technical Publications
web server - Borland Technical Publications web server - Borland Technical Publications
Naming Support and Configuration Naming Support and Configuration Since MDBs have no interfaces, MDBs do not have JNDI names in the normal sense like EJBHome objects do. Instead, they are associated with two objects that must preexist in JNDI before the MDB is deployed. These are: ■ a connection factory to use for connecting to the JMS services provider and ■ a queue/topic on that provider to listen to for incoming messages The JNDI names for these objects are specified in the MDB's ejb-borland.xml deployment descriptor. The captures the resource connection factory used to connect to the JMS service provider. The element captures the actual topic/queue on which the MDB is to listen. Once these elements are specified, the MDB has all the information it needs to connect to the JMS service provider, receive messages, and send replies. Connecting to JMS Connection Factories from MDBs MDBs provide a special case for connecting to JMS connection factories. In ejbjar.xml, attaching a JMS resource to an MDB requires the entry in the MDB's declaration. For example: MyMDBTopic ... javax.jms.Topic Durable ... Consult the J2EE 1.3 Specification for the proper uses of this element. Again, the Borland-specific XML file binds the logical name with the JNDI name. It uses two elements to accomplish this: and . First, let's examine the element from the ejb-borland.xml DTD: It's hardly a complicated element. Its value is the JNDI name of the JMS topic or queue connection factory. That is, it is identical to the element found within the declaration we just discussed. So, the ejb-borland.xml declaration for an MDB looks like this: MyMDBTopic ... serial://resources/tcf Now, we need to specify the JNDI name of the individual queue or topic. This is done with the element. Let's have a look at its DTD entry. Chapter 20: Message-Driven Beans and JMS 185
Clustering of MDBs This is yet another simple element. It's value is essentially identical to the value of the element found within the declaration discussed above. Now our XML looks like the following: MyMDBTopic ... serial://resources/tcf serial://resources/tcf ... Note Once deployed, you can access datasources from the MDB MyMDBTopic. The connection factory objects are much like JDBC datasources and the names of topics and queues are similar to specifying a database table name. The connection factory objects themselves are typed, for example TopicConnectionFactory and QueueConnectionFactory, depending upon what you are listening for. Furthermore, each of subtype of XA flavor is are needed when global transactions are in effect. In the typical development environment, there is only one JMS service provider, so only a pair of connection factories are required: one for topics and one for queues. Go to Chapter 23, “Using JMS” for detailed information on configuring these. You must use an XA connection factory when the MDB is deployed with the REQUIRED transaction attribute. The whole idea of this deployment is to enable the consumption of the message that drives the MDB to share the same transaction as any other work that is done from within the MDB.onMessage() method. To achieve this the container performs XA coordination with the JMS service provider and any other resources enlisted in the transaction. Clustering of MDBs The clustering of MDBs differs from the clustering of other enterprise beans. With MDBs, producers put messages into a destination. The messages will reside in the destination until a consumer takes the messages off the destination (or, if the messages are non-durable, when the server hosting the destination crashes). This is a pull model since the message will just reside on the destination until a consumer asks for it. The containers contend to get the next available message on the destination. MDBs provide an ideal load-balancing paradigm, one that is smoother than other enterprise bean implementations for distributing a load. The server that is the least burdened can ask for and obtain the message. The trade-off for this optimal loadbalancing is that messaging has extra container overhead by virtue of the destination's position between the producer and the consumer. There is not, however, the same concept of failover with a messaging service as exists in VisiBroker. If the consumer disappears, the queue fills up with messages. As soon as the consumer is brought back online, the messages resume being consumed. Of course, the JMS server itself should be fault-tolerant. The client should never notice any “failure” with the exception of response delays if such messages are expected. This kind of fault tolerance demands only a way of detecting failed consumers and activating them after failure. If you have the Borland Deployment Operations System (BDOC) installed and running, it will automatically maintain the desired state of its clustered services under active management. 186 BES Developer’s Guide
- Page 145 and 146: Container-Managed Persistence in Bo
- Page 147 and 148: Container-Managed Persistence in Bo
- Page 149 and 150: Container-Managed Persistence in Bo
- Page 151 and 152: Container-Managed Persistence in Bo
- Page 153 and 154: 142 BES Developer’s Guide
- Page 155 and 156: Setting Properties J2EE 1.3 Entity
- Page 157 and 158: Setting Properties Figure 16.2 Edit
- Page 159 and 160: Setting Properties Table 16.1 ejb.m
- Page 161 and 162: Setting Properties Table 16.3 Table
- Page 163 and 164: Setting Properties Security Propert
- Page 165 and 166: Aggregate Functions in EJB-QL Selec
- Page 167 and 168: Support for ORDER BY Support for OR
- Page 169 and 170: Overriding SQL generated from EJB-Q
- Page 171 and 172: Container-managed data access suppo
- Page 173 and 174: 162 BES Developer’s Guide
- Page 175 and 176: Generating primary keys from a cust
- Page 177 and 178: Implementing primary key generation
- Page 179 and 180: Transaction manager services Consis
- Page 181 and 182: Transaction manager services When t
- Page 183 and 184: Transaction manager services Follow
- Page 185 and 186: Declarative transaction management
- Page 187 and 188: Declarative transaction management
- Page 189 and 190: JDBC API Modifications JDBC API Mod
- Page 191 and 192: Handling of EJB exceptions Applicat
- Page 193 and 194: 182 BES Developer’s Guide
- Page 195: Client View of an MDB Client View o
- Page 199 and 200: Error Recovery Redelivered messages
- Page 201 and 202: 190 BES Developer’s Guide
- Page 203 and 204: JNDI Definitions Module Important s
- Page 205 and 206: Disabling and Enabling a Deployed D
- Page 207 and 208: Configuring JDBC Datasources In the
- Page 209 and 210: Configuring JDBC Datasources To add
- Page 211 and 212: Defining the Connection Pool Proper
- Page 213 and 214: Defining the Connection Pool Proper
- Page 215 and 216: Descriptions of Borland Enterprise
- Page 217 and 218: Advanced Topics for Defining JDBC D
- Page 219 and 220: Connecting to JDBC Resources from J
- Page 221 and 222: Configuring JMS Connection Factorie
- Page 223 and 224: Defining Connection Pool Properties
- Page 225 and 226: Obtaining JMS Connection Factories
- Page 227 and 228: JMS and Transactions and its accomp
- Page 229 and 230: JMS and Transactions For instance:
- Page 231 and 232: 220 BES Developer’s Guide
- Page 233 and 234: Configuring JMS administered object
- Page 235 and 236: Tibco Creating Clustered JMS Servic
- Page 237 and 238: Sonic serverUrl String localhost:72
- Page 239 and 240: Sonic Creating Clustered JMS Servic
- Page 241 and 242: OpenJMS Even though OpenJMS can be
- Page 243 and 244: OpenJMS Important If you use OpenJM
- Page 245 and 246: OpenJMS openjms.clean_messages_on_s
Clustering of MDBs<br />
This is yet another simple element. It's value is essentially identical to the value of the<br />
element found within the declaration discussed above.<br />
Now our XML looks like the following:<br />
<br />
MyMDBTopic<br />
...<br />
serial://resources/tcf<br />
serial://resources/tcf<br />
...<br />
Note<br />
<br />
Once deployed, you can access datasources from the MDB MyMDBTopic.<br />
The connection factory objects are much like JDBC datasources and the names of<br />
topics and queues are similar to specifying a database table name. The connection<br />
factory objects themselves are typed, for example TopicConnectionFactory and<br />
QueueConnectionFactory, depending upon what you are listening for. Furthermore, each<br />
of subtype of XA flavor is are needed when global transactions are in effect. In the<br />
typical development environment, there is only one JMS service provider, so only a<br />
pair of connection factories are required: one for topics and one for queues. Go to<br />
Chapter 23, “Using JMS” for detailed information on configuring these.<br />
You must use an XA connection factory when the MDB is deployed with the REQUIRED<br />
transaction attribute. The whole idea of this deployment is to enable the consumption<br />
of the message that drives the MDB to share the same transaction as any other work<br />
that is done from within the MDB.onMessage() method. To achieve this the container<br />
performs XA coordination with the JMS service provider and any other resources<br />
enlisted in the transaction.<br />
Clustering of MDBs<br />
The clustering of MDBs differs from the clustering of other enterprise beans. With<br />
MDBs, producers put messages into a destination. The messages will reside in the<br />
destination until a consumer takes the messages off the destination (or, if the<br />
messages are non-durable, when the <strong>server</strong> hosting the destination crashes). This is a<br />
pull model since the message will just reside on the destination until a consumer asks<br />
for it. The containers contend to get the next available message on the destination.<br />
MDBs provide an ideal load-balancing paradigm, one that is smoother than other<br />
enterprise bean implementations for distributing a load. The <strong>server</strong> that is the least<br />
burdened can ask for and obtain the message. The trade-off for this optimal loadbalancing<br />
is that messaging has extra container overhead by virtue of the destination's<br />
position between the producer and the consumer.<br />
There is not, however, the same concept of failover with a messaging service as exists<br />
in VisiBroker. If the consumer disappears, the queue fills up with messages. As soon<br />
as the consumer is brought back online, the messages resume being consumed. Of<br />
course, the JMS <strong>server</strong> itself should be fault-tolerant. The client should never notice<br />
any “failure” with the exception of response delays if such messages are expected.<br />
This kind of fault tolerance demands only a way of detecting failed consumers and<br />
activating them after failure. If you have the <strong>Borland</strong> Deployment Operations System<br />
(BDOC) installed and running, it will automatically maintain the desired state of its<br />
clustered services under active management.<br />
186 BES Developer’s Guide