e-docs > WebLogic Server > Administration Guide > Managing JMS |
Administration Guide |
The following sections explain how to manage the Java Message Service (JMS) for WebLogic Server:
JMS is a standard API for accessing enterprise messaging systems. Specifically, WebLogic JMS:
The following figure illustrates WebLogic JMS messaging.
Figure 9-1 WebLogic Server JMS Messaging
As illustrated in the figure, WebLogic JMS accepts messages from producer applications and delivers them to consumer applications.
Using the Administration Console, you define configuration attributes to:
WebLogic JMS provides default values for some configuration attributes; you must provide values for all others. If you specify an invalid value for any configuration attribute, or if you fail to specify a value for an attribute for which a default does not exist, WebLogic Server will not boot JMS when you restart it. A sample examplesJMSServer configuration is provided with the product in the Examples Server. For more information about starting the Examples Server, see "Starting the Default, Examples, and Pet Store Servers" in the Installation Guide. There are also instructions for manually configuring a basic JMS implementation in Starting WebLogic Server and Configuring JMS.
When you port WebLogic JMS applications from a previous release of Weblogic Server, the configuration information is automatically converted, as described in "Porting WebLogic JMS Applications" in Programming WebLogic JMS.
To configure WebLogic JMS attributes, follow the procedures described in the following sections, or in the Administration Console Online Help, to create and configure the JMS objects.
Once WebLogic JMS is configured, applications can send and receive messages using the JMS API. For more information about developing WebLogic JMS applications, refer to "Developing a WebLogic JMS Application" in Programming WebLogic JMS.
Note: To assist with your WebLogic JMS configuration planning, Programming WebLogic JMS provides configuration checklists for the attribute requirements and/or options that support various JMS features.
JMS Resource Naming Rules for Domain Interoperability
Within a WebLogic domain, each server instance, machine, cluster, virtual host, and any other resource type must be named uniquely and must not use the same name as the domain. These unique naming rules also apply to all JMS resources in either a single WebLogic domain or in a multi-domain environment.
Naming Rules for JMS Resources In a Single Domain Environment
For WebLogic JMS intra-domain interoperability, either between standalone or clustered server instances, the unique resource naming rule applies to all configurable JMS objects, such as JMS servers, stores (file or JDBC), templates, connection factories, session pools, and connection consumers. For example, you cannot have two similarly named JMS servers (e.g., myJMSServer) targeted to two different server instances within a domain.
For more information on how JMS clustering works, refer to "Configuring WebLogic JMS Clustering" in Programming WebLogic JMS
An exception to this unique naming rule within a domain, however, is for JMS queue and topic destinations on different JMS servers in a domain, as follows:
Naming Rules for JMS Resources In a Multi-Domain Environment
With the exception of JMS connection factories, the single domain naming rules for WebLogic JMS resources also apply to achieve successful inter-domain operability when using the Messaging Bridge to access other WebLogic domains. This rule includes domains from different releases of WebLogic Server.
For example, you cannot create a WebLogic Server instance named myserver in a version 7.0 domain named mydomain70 if there is already a server instance named myserver in a version 6.1 domain named mydomain61. Similarly, on the JMS subsystem level, you cannot have two JMS servers or stores with the same name, even when they reside in separate domains.
Therefore, you must adhere to the following rules when interoperating between WebLogic domains:
For detailed information about configuring a Messaging Bridge to interoperate with WebLogic domains, see Using the Messaging Bridge to Interoperate with Different WebLogic Server Releases and Domains.
Starting WebLogic Server and Configuring JMS
The following sections review how to start WebLogic Server and the Administration console, as well as provide a procedure for configuring a basic JMS implementation.
Starting the Default WebLogic Server
The default role for a WebLogic Server is the Administration Server. If a domain consists of only one WebLogic Server, that server is the Administration Server. If a domain consists of multiple WebLogic Servers, you must start the Administration Server first, and then you start the Managed Servers.
For complete information about starting the Administration Server, see Starting an Administration Server.
Starting the Administration Console
The Administration Console is the Web-based administrator front-end (administrator client interface) to WebLogic Server. You must start the server before you can access the Administration Console for a server.
For complete details about using the Administration Console to configure a WebLogic Server, see Starting and Using the Administration Console.
Configuring a Basic JMS Implementation
This section describes how to configure a basic JMS implementation using the Administration Console.
For more information on configuring stores, see Configuring Stores.
For more information on using JMS JDBC stores, see About JMS JDBC Stores. For more information on configuring JDBC connection pools, see Configuring and Managing JDBC Connection Pools, MultiPools, and DataSources Using the Administration Console.
For more information on configuring a JMS Template, see Configuring JMS Templates.
For more information on configuring a JMS Server, see Configuring JMS Servers.
For more information on configuring a Destinations, see Configuring Destinations.
For more information on configuring a Connection Factory, see Configuring Connection Factories.
A JMS server manages connections and message requests on behalf of clients. To create a JMS server, use the Servers node in the Administration Console and define the following:
Note: JMS servers must be uniquely named within a domain. For more information, see JMS Resource Naming Rules for Domain Interoperability.
Note: The deployment of a JMS server differs from that of a connection factory or template. A JMS server is deployed on a single WebLogic Server instance or on a migratable target (see next bullet item); whereas, a connection factory or template can be instantiated on multiple WebLogic Server instances simultaneously.
For instructions on creating and configuring a JMS server, see "JMS Server Tasks" in the Administration Console Online Help.
Configuring Connection Factories
Connection factories are objects that enable JMS clients to create JMS connections. A connection factory supports concurrent use, enabling multiple threads to access the object simultaneously. WebLogic JMS provides a preconfigured default connection factory, weblogic.jms.ConnectionFactory, that can be disabled on a per-server basis, as described in "Server --> Services --> JMS" in the Administration Console Online Help. Otherwise, you can configure one or more connection factories to create connections with predefined attributes that better suit your application — as long as each connection factory is uniquely named. WebLogic Server adds them to the JNDI space during startup, and the application then retrieves a connection factory using WebLogic JNDI.
You can establish cluster-wide, transparent access to destinations from any server in a cluster either by enabling the default connection factory for each server instance, or by configuring one or more connection factories and targeting them to one or more server instances in the cluster. This way, each connection factory can be deployed on multiple WebLogic Servers. For more information on configuring JMS clustering, see "Managing JMS" in Programming WebLogic JMS.
To configure connection factories, use the Connection Factories node in the Administration Console to define the following:
Note: JMS connection factories must be uniquely named within a domain. For more information, see JMS Resource Naming Rules for Domain Interoperability.
For the default connection factory, weblogic.jms.ConnectionFactory, all configuration attributes are set to their default values. If the default connection factory definition is appropriate for your application, you do not need to configure any additional connection factories for your application.
Note: Using the default connection factory, you have no control over the WebLogic Server on which the connection factory may be deployed. If you would like to target a particular server, create a new connection factory and specify the appropriate server target(s).
For instructions on creating and configuring a connection factory, see "Connection Factory Tasks" in the Administration Console Online Help.
Some connection factory attributes are dynamically configurable. When dynamic attributes are modified at run time, the new values become effective for new connections only, and do not affect the behavior of existing connections.
A destination identifies a queue (Point-To-Point) or a topic (Pub/Sub) for a JMS server. After defining a JMS server, configure one or more destination for each JMS server.
You configure destinations explicitly or by configuring a destination template that can be used to define multiple destinations with similar attribute settings, as described in Configuring JMS Templates.
Note: You can also configure multiple physical destinations as members of a single distributed destination set within a cluster. Therefore, if one instance within the cluster fails, then other instances of the same destination will be able to provide service to JMS producers and consumers. For more information, see Configuring Distributed Destinations.
To configure destinations explicitly, use the Destinations node in the Administration Console to define the following configuration attributes:
Note: JMS destinations have unique naming restrictions within a domain. For more information, see JMS Resource Naming Rules for Domain Interoperability.
For instructions on creating and configuring a destination, see "JMS Destination Tasks" in the Administration Console Online Help.
Some destination attributes are dynamically configurable. When attributes are modified at run time, only incoming messages are affected; stored messages are not affected.
A JMS template provides an efficient means of defining multiple destinations with similar attribute settings. JMS templates offer the following benefits:
To define the JMS template configuration attributes for destinations, use the Templates node in the Administration Console. The configurable attributes for a JMS template are the same as those configured for a destination. These configuration attributes are inherited by the destinations that use them, with the following exceptions:
Note: JMS templates must be uniquely named within a domain. For more information, see JMS Resource Naming Rules for Domain Interoperability.
Any attributes that are not explicitly defined for a destination are assigned default values. If no default value exists, be sure to specify a value within the JMS template or as a destination attribute override. If you do not do so, the configuration information remains incomplete, the WebLogic JMS configuration fails, and the WebLogic JMS does not boot.
For instructions on creating and configuring a JMS template, see "JMS Template Tasks" in the Administration Console Online Help.
Use destination keys to define the sort order for a specific destination.
To create a destination key, use the Destination Keys node in the Administration Console and define the following configuration attributes:
For instructions on creating and configuring a destination key, see "Destination Key Tasks" in the Administration Console Online Help.
A persistent store consists of a file or database that is used for persistent messaging. To create a file or database store, use the Stores node in the Administration Console and define the following configuration attributes:
Note: JMS stores must be uniquely named within a domain. For more information, see JMS Resource Naming Rules for Domain Interoperability.
Warning: You cannot configure a transaction (XA) connection pool to be used with a JDBC database store. For more information, see JMS JDBC Transactions.
JMS persistent stores can increase the amount of memory required during initialization of a WebLogic Server instance as the number of stored messages increases. If initialization fails due to insufficient memory while rebooting WebLogic Server, increase the heap size of the Java Virtual Machine (JVM) proportionally to the number of messages that are currently stored in the JMS persistent store. Then, try rebooting the server again. For more information on setting heap sizes, see "Tuning WebLogic Server Applications" in the WebLogic Performance and Tuning Guide.
For instructions on creating and configuring a store, see "JMS File Store Tasks" and "JMS JDBC Store Tasks" for information about file and JDBC database stores, respectively, in the Administration Console Online Help.
Through the use of JDBC, JMS enables you to store persistent messages in a database, which is accessed through a designated JDBC connection pool. The JMS database can be any database that is accessible through a JDBC driver. WebLogic JMS detects some drivers for the following databases:
The weblogic/jms/ddl directory within the weblogic.jar file contains JMS DDL files for these databases, which are actually text files containing the SQL commands that create the JMS database tables. To use a different database, simply copy and edit any one of these .ddl files.
Note: The JMS samples provided with your WebLogic Server distribution are set up to work with the Pointbase Java database. An evaluation version of Pointbase is included with WebLogic Server and a demoPool database is provided.
If your existing JMS JDBC stores somehow become corrupted, you can regenerate them using the utils.Schema utility. For more information see, "JDBC Database Utility" in Programming WebLogic JMS.
You cannot configure a transaction (XA) JDBC connection pool to be used with a JMS JDBC store. JMS must use a JDBC connection pool that uses a non-XAResource driver (you cannot use an XA driver or a JTS driver). JMS does the XA support above the JDBC driver.
This is because WebLogic JMS is its own resource manager. That is, JMS itself implements the XAResource and handles the transactions without depending on the database (even when the messages are stored in the database). This means that whenever you are using JMS and a database (even if it is the same database where the JMS messages are stored), then it is two-phase commit transaction. For more information about using transactions with WebLogic JMS, see "Using Transactions with WebLogic JMS" in Programming WebLogic JMS.
From a performance perspective, you may boost your performance if the JDBC connection pool used for the database work exists on the same WebLogic Server as the JMS queue—the transaction will still be two-phase, but it will be handled with less network overhead. Another performance boost might be achieved by using JMS file stores rather than JMS JDBC stores.
Optionally, you can restrict the JDBC connection pool resource. In previous releases of WebLogic Server, ACLs were used to protect WebLogic resources. In WebLogic Server version 7.0, security policies answer the question "who has access" to a WebLogic resource. A security policy is created when you define an association between a WebLogic resource and a user, group, or role. A WebLogic resource has no protection until you assign it a security policy. For instructions on how to set up security for all WebLogic Server resources, see "Setting Protections for WebLogic Resources" in the Administration Console Online Help.
Using Oracle Primary Keys with a JMS JDBC Store
For Oracle databases, Advanced Oracle Replication cannot replicate tables with the LONG or LONG RAW data type columns, but instead requires the use of Primary Keys. To achieve this, modify the default Oracle DDL file to manually add Primary Keys to the JMSStore table used by a JMS JDBC Store.
The jms_oracle.ddl file is preconfigured and supplied in the WebLogic CLASSPATH (in the WL_HOME/server/lib/weblogic.jar file, where WL_HOME is the top-level directory of your WebLogic Server installation).
For cases where the JMSStore and JMSState tables already exist, then these tables must be dropped and recreated to use a modified DDL file.
jar xf weblogic.jar /weblogic/jms/ddl
About JMS JDBC Store Table Prefixes
The JMS database contains two system tables that are generated automatically and are used internally by JMS:
The prefix name uniquely identifies JMS tables in the persistent store. Specifying unique prefixes allows multiple stores to exist in the same database. You configure the prefix via the Administration Console when configuring a JMS JDBC store. A prefix is prepended to table names when the DBMS requires fully qualified names, or when you must differentiate between JMS tables for two WebLogic Servers, enabling multiple tables to be stored on a single DBMS.
Warning: No two JMS JDBC stores should be allowed to use the same database tables, as this will result in data corruption.
Specify the prefix using the following format, which will result in a valid table name when prepended to the JMS table name:
[[[catalog.]schema.]prefix]JMSStore
where catalog identifies the set of system tables being referenced by the DBMS and schema translates to the ID of the table owner. For example, in a production database the JMS administrator could maintain a unique table for the Sales department, as follows:
[[[Production.]JMSAdmin.]Sales]JMSStore
The resulting table will be created in the Production catalog, under the JMSAdmin schema, and will be named SalesJMSStore.
Note: For some DBMS vendors, such as Oracle, there is no catalog to set or choose, so this format simplifies to [[schema.]prefix]. For more information, refer to your DBMS documentation for instructions on how to write and use a fully-qualified table name.
Recommended JDBC Connection Pool Settings for JMS JDBC Stores
WebLogic Server provides robust JDBC connection pools that can automatically reconnect to failed databases after they come back online, without requiring you to restart WebLogic Server. To take advantage of this capability, and make your use of JMS JDBC stores more robust, configure the following attributes on the JDBC connection pool associated with the JMS JDBC store:
TestConnectionsOnReserve="true"
TestTableName="SYSTABLES"
For more information about JDBC default Test Table Names, see "Connection Testing Options" in see "JDBC Connection Pool -> Configuration -> Testing" in the Administration Console Online Help.
Server session pools enable an application to process messages concurrently. After you define a JMS server, optionally, configure one or more session pools for each JMS server.
Use the Session Pools node in the Administration Console and define the following configuration attributes:
For instructions on creating and configuring a session pool, see "Session Pool Tasks" in the Administration Console Online Help.
Some session pool attributes are dynamically configurable, but the new values do not take effect until the session pools are restarted.
Configuring Connection Consumers
Connection consumers are queues (Point-To-Point) or topics (Pub/Sub) that retrieve server sessions and process messages. After you define a session pool, configure one or more connection consumers for each session pool.
To configure connection consumers, use the Session Pools node in the Administration Console to define the following configuration attributes:
To create and configure a connection consumer, and for detailed information about each of the connection consumer configuration attributes, see "Connection Consumer" in the Administration Console Online Help.
Using the Administration Console, you can monitor statistics for the following JMS objects: JMS servers, connections, sessions, destinations, message producers, message consumers, server session pools, and durable subscribers.
JMS statistics continue to increment as long as the server is running. Statistics are reset only when the server is rebooted.
Note: For instructions on monitoring JMS connections to WebLogic Server, refer to the Servers section in the Administration Console Online Help.
To view run-time information for active JMS servers, destinations, and session pools:
Note: When monitoring distributed destinations, you may see proxy topic members or system subscriptions for the topic or queue members. For more information see, Monitoring Distributed Destination System Subscriptions and Proxy Topic Members.
Monitoring Durable Subscribers
To view JMS durable subscribers that are running on destination topics:
Monitoring Distributed Destination System Subscriptions and Proxy Topic Members
In certain JMS configuration for Weblogic Server 7.0, distributed destinations may automatically create proxy topic members or system subscriptions between the topic or queue members. If this occurs, system subscriptions and proxy topic members will appear in MBean statistics, as well as in the Administration Console, when monitoring distributed destination members. They may also appear in the durable subscription names and in the consumer counts for the distributed destination members.
The following points describe the behavior of system subscriptions and proxy topic members:
The following sections explain how to get the most out of your applications by implementing the administrative performance tuning features available with WebLogic JMS.
The following sections describe the tuning options available when using persistent stores with WebLogic Server JMS.
Configuring a Synchronous Write Policy for JMS File Stores
By default, WebLogic JMS file stores guarantee up-to-the-message integrity by using synchronous writes. Disabling synchronous writes improves file store performance, often quite dramatically, but at the expense of possibly losing sent messages or generating duplicate received messages (even if messages are transactional) in the event of an operating system crash or a hardware failure. Simply shutting down an operating system will not generate these failures, as an OS flushes all outstanding writes during a normal shutdown. Instead, these failures can be emulated by shutting the power off to a busy server.
Note: The Synchronous Write Policy is ignored if the file store is used exclusively for paging non-persistent messages to disk.
Table 9-1 explains the options available when configuring a Synchronous Write Policy for all JMS file stores running on WebLogic Server.
Warning: Unlike Sun Solaris, use of the Direct-Write policy on Windows may leave transaction data in the on-disk cache without writing it to disk immediately. This is not transactionally safe, as a power failure can cause loss of on-disk cache data, resulting in lost and/or duplicate messages. For reliable writes using Direct-Write on Windows, either disable all write caching for the disk (enabled by default), or use a disk with a battery backed cache.
To disable the on-disk cache for a hard disk on Windows, do the following: Start -> Settings -> Control Panel -> System -> Hardware tab -> click the Device Manager button -> Disk Drives -> double-click the drive name -> Disk Properties tab -> clear the Write Caching Enabled check box. Some file systems, however, do not allow this value to be changed (for example, a RAID system that has a reliable cache).
The following tables compare the synchronous write policies with respect to reliability, performance, and scalability. Use the following key to interpret the expected results based on your synchronous write policy settings.
With the message paging feature, you can free up virtual memory during peak message load periods. This feature can greatly benefit applications with large message spaces.
JMS message paging saves memory for both persistent and non-persistent messages, as even persistent messages cache their data in memory. Paged persistent messages continue to be written to the regular backing store (file or database); and paged non-persistent messages are written to the JMS server's message paging store, which is configured separately.
A paged-out message does not free all of the memory that it consumes. The message header and message properties remain in memory for use with searching, sorting, and filtering.
Note: Messages sent in a transacted session are only eligible for paging after the session is committed. Prior to that, the message will only be held in memory; therefore, the heap size of the Java Virtual Machine (JVM) should be appropriately tuned to accommodate the projected peak amount of client load from all active sessions until they are committed. For more information on tuning your heap size, see "Tuning Java Virtual Machines (JVMs)" in WebLogic Performance and Tuning.
Unless paging is configured and enabled, all messages (even persistent ones) are held in memory. You can configure paging for a new or existing JMS server and/or its destinations through the Administration Console. Using the attributes on the JMS Server node you can specify a paging store for a JMS server, enable bytes and/or messages paging, and configure bytes/messages high and low thresholds to start and stop paging.
Similarly, using the attributes on the Destinations node, you can configure bytes/messages paging for all topics and queues configured on a JMS server. The destinations use the paging store that is configured for the JMS server.
Also, if you use JMS templates to configure multiple destinations, you can use the attributes on the Templates node to configure paging quickly on all your destinations. To override a template's paging configuration for specific destinations, you can enable or disable paging on any destination.
For instructions on configuring a new JMS server, templates, and destinations (Topics or Queues), see "JMS Server," "JMS Destination," and "JMS Template" in the Administration Console Online Help.
Note: For performance tuning purposes, you can modify the paging thresholds to any legal value at any time. Once paging is enabled, however, you cannot dynamically disable it by resetting a byte or message threshold back to -1. To prevent paging from occurring, set the byte/message high threshold to a very large number (maximum is 263 -1), so that paging is not triggered.
Configuring a Paging Store for a JMS Server
Each JMS server must have its own paging store, which is used exclusively for paging out non-persistent messages for the JMS server and its destinations. It's best to use a JMS file store rather than a JMS JDBC store, as the JDBC store will perform poorly in comparison without any real benefit.
To configure a new paging store:
Configuring Paging on a JMS Server
To enable and configure paging on an existing JMS server:
For instructions on configuring a paging store, refer to Configuring a Paging Store for a JMS Server.
Configuring Paging on a JMS Template
JMS templates provide an efficient way to define multiple destinations (topics or queues) with similar attribute settings. To configure paging on a template for destinations, do the following:
Configuring Paging on Destinations
Follow these directions if you are configuring paging on destinations without using a JMS template.
Note: If you use JMS templates to configure your destinations, a destination's explicit Byte/Messages Paging configuration overrides the template's configuration. For more information, refer to Configuring a Destination to Override Paging on a JMS Template and to Configuring JMS.
Configuring a Destination to Override Paging on a JMS Template
Follow these directions if you want to override a template's settings and enable or disable paging on a specific destination.
The following sections briefly describe the paging attributes available with WebLogic Server JMS.
Table 9-4 describes the paging attributes that you define when configuring paging on a JMS Server. For detailed information about other JMS Server attributes, and the valid and default values for them, see "JMS Server" in the Administration Console Online Help.
JMS Template Paging Attributes
Table 9-5 describes the paging attributes that you define when configuring paging on JMS templates for destinations. For detailed information about other JMS template attributes, and the valid and default values for them, see "JMS Template" in the Administration Console Online Help.
JMS Destination Paging Attributes
Table 9-6 describes the attributes that you define when configuring paging on destinations. For detailed information about other JMS destination attributes, and valid and default values for them, see "JMS Destination" in the Administration Console Online Help.
Note: If server paging is enabled, and destination-level paging is disabled for a given destination, than messages on the destination can still be paged if server paging is triggered. However, when destination-level paging is disabled for a given destination, then the destination's high thresholds will not force the destination to page out messages when they are exceeded.
Table 9-7 briefly describes the bytes and messages paging thresholds available with JMS servers, templates, and destinations. For detailed information about other JMS server, template, and destination attributes, and the valid and default values for them, see "JMS Server," "JMS Destination," and "JMS Template" in the Administration Console Online Help.
The thresholds are defined for servers, templates, and destinations as follows:
Establishing Message Flow Control
With the WebLogic JMS flow control feature, you can enable a JMS server or destination to slow down message producers when it determines that it is becoming overloaded. Specifically, when a JMS server/destination exceeds its specified bytes or messages thresholds, it becomes armed and instructs producers to limit their message flow (messages per second).
Producers limit their production rate based on a set of flow control attributes configured for producers via the JMS connection factory. Starting at a specified flow maximum number of messages, a producer evaluates whether the server/destination is still armed at prescribed intervals (for example, every 10 seconds for 60 seconds). If at each interval, the server/destination is still armed, then the producer continues to move its rate down to its prescribed flow minimum amount.
As producers slow themselves down, the threshold condition gradually corrects itself until the server/destination is unarmed. At this point, a producer is allowed to increase its production rate, but not necessarily to the maximum possible rate. In fact, its message flow continues to be controlled (even though the server/destination is no longer armed) until it reaches its prescribed flow maximum, at which point it is no longer flow controlled.
Producers receive a set of flow control attributes from their session, which receives the attributes from the connection, and which receives the attributes from the connection factory. You configure the flow control attributes on the JMS connection factory via the Administration Console.
These attributes allow the producer to adjust its message flow. Specifically, the producer receives attributes that limit its flow within a minimum and maximum range. As conditions worsen, the producer moves toward the minimum; as conditions improve; the producer moves toward the maximum. Movement toward the minimum and maximum are defined by two additional attributes that specify the rate of movement toward the minimum and maximum. Also, the need for movement toward the minimum and maximum is evaluated at a configured interval.
To configure message flow control on a connection factory, follow these steps:
For detailed information about other connection factory attributes, and the valid and default values for them, see "JMS Connection Factory" in the Administration Console Online Help.
The attributes used for configuring bytes/messages thresholds are defined as part of the JMS server and JMS destination. Table 9-9 defines how these thresholds start and stop flow control on a JMS server and/or JMS destination.
For detailed information about other JMS server and JMS destination attributes, and the valid and default values for them, see "JMS Server" and "JMS Destination" in the Administration Console Online Help.
Tuning a Distributed Destination
The following sections describe how to tune a distributed destination by configuring the Load Balancing and Server Affinity attributes on the JMS Connection Factory. For more information about configuring a distributed destination, see Configuring Distributed Destinations.
Configuring Message Load Balancing for a Distributed Destination
The Load Balancing Enabled attribute on the JMS Connection Factory
To ensure a fair distribution of the messaging load among a distributed destination, the initial physical destination (queue or topic) used by producers is always chosen at random from among the distributed destination members.
To configure load balancing on a connection factory:
Note: Depending on your implementation, the setting of the Server Affinity Enabled attribute can affect the load balancing preferences for distributed destinations. For more information, see "How Distributed Destination Load Balancing Is Affected When Using the Server Affinity Enabled Attribute" in Programming WebLogic JMS.
Anonymous producers (producers that do not designate a destination when created), are load-balanced each time they switch destinations. If they continue to use the same destination, then the rules for non-anonymous producers apply (as stated previously).
For more information about how message load balancing takes place among the members of a distributed destination, see "Load Balancing Messages Across a Distributed Destination" in Programming WebLogic JMS.
Configuring Server Affinity for a Distributed Destination
The Server Affinity Enabled attribute on the JMS Connection Factory
Note: The Server Affinity Enabled attribute does not affect queue browsers. Therefore, a queue browser created on a distributed queue can be pinned to a remote distributed queue member even when Server Affinity is enabled.
To disable server affinity on a connection factory:
For more information about how the Server Affinity Enabled setting affects the load balancing among the members of a distributed destination, see "How Distributed Destination Load Balancing Is Affected When Using the Server Affinity Enabled Attribute" in Programming WebLogic JMS.
Configuring Distributed Destinations
A distributed destination is a set of physical destinations (queues or topics) that are called under a single JNDI name so they appear to be a single, logical destination to a client when the members of the set are actually distributed across multiple servers within a cluster, with each destination member belonging to a separate JMS server.
By enabling you to configure multiple physical queues and topics as members of a distributed destination, WebLogic JMS supports high availability and load balancing of the JMS destinations within a cluster. For instructions on using a distributed destination with your applications, see "Developing a WebLogic JMS Application" in Programming WebLogic JMS.
Guidelines for Configuring Distributed Destinations
You configure distributed JMS destinations through the Services
Configuration Best Practices for Distributed Destinations
To simplify the management and development of distributed destination applications, BEA recommends deploying a distributed destination consistently across the cluster by using similar configurations for each participating JMS server and it's associated physical destinations. This should include consistent configuration of JMS stores, message paging, error destinations, message/bytes quotas, and connection factories. For example, when persistent messaging is configured, you should ensure that each distributed member is associated with a similar JMS store, with regards to capacity and performance.
The recommended method for maintaining configuration consistency for distributed destination members is to use JMS templates, since they are the most reliable way to centralize any custom configuration that is common to each physical destination. For newly created distributed destination members configured using the Administration Console, use the JMS template that is automatically created for those members, as described in Automatic JMS Template Creation. And for a distributed destination created to represent existing physical destinations, use the JMS template associated with those physical destinations if one exists; otherwise, configure one, as described in Configuring JMS Templates.
Warning: To avoid application failure issues, consistent security permissions must be configured on each participating distributed destination member. For example, if one member of a distributed destination has different send restrictions than the other members, an application may sometimes be allowed to send to the distributed destination, and yet other times it may be forbidden.
Load Balancing and Server Affinity Tuning
The default Load Balancing Enabled and Server Affinity Enabled values for tuning a distributed destination configuration can be modified on the JMS connection factory through the Administration Console. For more information, see Configuring Message Load Balancing for a Distributed Destination and Configuring Server Affinity for a Distributed Destination.
Automatic JMS Template Creation
When a distributed destination is created with new distributed topic or queue members through the Administration Console, a corresponding JMS template is automatically created with default attribute values for those members. The new JMS template appears under the JMS Templates node with the same name as the distributed destination. The thresholds, quotas, and other attributes for the distributed destination members can be reset using this template. For more information on using JMS templates, see Configuring JMS Templates.
In a clustered configuration, untargeting or deleting a JMS server that is hosting a distributed destination member — without first manually deleting that member from the distributed destination configuration — can cause the configuration file (config.xml) to become unbootable. For instructions on deleting distributed destination members, see Deleting a JMS Distributed Queue Member and Deleting a JMS Distributed Topic Member.
Creating a Distributed Topic and Creating Members Automatically
Follow these steps to configure a distributed topic and automatically create its topic members on JMS servers that are part of a WebLogic Server cluster (for high availability) or on an single WebLogic Server instance that is not part of a cluster.
Uniquely identify the distributed topic within a WebLogic Server domain. |
|
Enter the name used to bind the distributed topic into the JNDI namespace. Applications use the JNDI Name to look up the distributed topic. A distributed topic that does not have a JNDI Name can be referenced by passing the Name of the distributed destination to: javax.jms.TopicSession.createTopic(). |
|
Define how producers will distribute their messages across the members of a distributed topic. The valid values are Round-Robin and Random as defined in Configuring Message Load Balancing for a Distributed Destination. |
For more information about these attributes, see "JMS Distributed Topic -> Configuration -> Thresholds & Quotas" in the Administration Console Online Help.
Creating a Distributed Topic and Adding Existing Physical Topics as Members Manually
For existing implementations of WebLogic JMS that require previously configured destinations to be members of a distributed destination set, follow these steps to configure a distributed topic and manually add your existing physical topics as members:
Uniquely identify the distributed topic within a WebLogic Server domain. |
|
Enter the name used to bind the distributed topic into the JNDI namespace. Applications use the JNDI Name to look up the distributed topic. A distributed topic that does not have a JNDI Name can be referenced by passing the Name of the distributed destination to: javax.jms.TopicSession.createTopic(). |
|
Define how producers will distribute their messages across the members of a distributed topic. The valid values are Round-Robin and Random as defined in Configuring Message Load Balancing for a Distributed Destination. |
If a distributed topic member's underlying physical topic already has a JMS Template with configured thresholds and quotas, these attributes do not apply to that topic member. For more information about these attributes, see "JMS Distributed Topic -> Configuration -> Thresholds & Quotas" in the Administration Console Online Help.
Note: If you want to automatically create topic members on JMS servers that are part of a WebLogic Server cluster (for high availability) or on an single WebLogic Server instance that is not part of a cluster, see Creating a Distributed Topic and Creating Members Automatically.
Uniquely identify the distributed topic member within a WebLogic Server domain. |
|
Select the underlying physical topic that is associated with the distributed topic member. |
|
Define the weight (that is, a measure of ability to handle message load) of the topic member with respect to other topic members in the distributed destination. The random distribution load-balancing algorithm uses the weight assigned to the physical destinations to compute a weighted distribution for the set of physical destinations. For more information, see "Developing a WebLogic JMS Application" in Programming WebLogic JMS. |
Creating a Distributed Queue and Creating Members Automatically
Follow these steps to configure a distributed queue and automatically create its queue members on JMS servers that are part of a WebLogic Server cluster (for high availability) or on an single WebLogic Server instance that is not part of a cluster.
Uniquely identify the distributed queue within a WebLogic Server domain. |
|
Enter the name used to bind the distributed queue into the JNDI namespace. Applications use the JNDI Name to look up the distributed queue. A distributed queue that does not have a JNDI Name can be referenced by passing the Name of the distributed destination to javax.jms.QueueSession.createQueue(). |
|
Define how producers will distribute their messages across the members of a distributed queue. The valid values are Round-Robin and Random as defined in Configuring Message Load Balancing for a Distributed Destination. |
|
Define the amount of time, in seconds, that a distributed queue member with messages, but which has no consumers, will wait before forwarding its messages to other queue members that do have consumers. |
For more information about these attributes, see "JMS Distributed Queue -> Configuration -> Thresholds & Quotas" in the Administration Console Online Help.
Creating a Distributed Queue and Adding Existing Physical Queues as Members Manually
For existing implementations of WebLogic JMS that require previously configured destinations to be members of a distributed destination set, follow these steps to configure a distributed queue and manually add your existing physical queues as members.
Uniquely identify the distributed queue within a WebLogic Server domain. |
|
Enter the name used to bind the distributed queue into the JNDI namespace. Applications use the JNDI Name to look up the distributed queue. A distributed queue that does not have a JNDI Name can be referenced by passing the Name of the distributed destination to javax.jms.QueueSession.createQueue(). |
|
Define how producers will distribute their messages across the members of a distributed queue. The valid values are Round-Robin and Random as defined in Configuring Message Load Balancing for a Distributed Destination. |
|
Define the amount of time, in seconds, that a distributed queue member with messages, but which has no consumers, will wait before forwarding its messages to other queue members that do have consumers. |
If a distributed queue member's underlying physical queue already has a JMS Template with configured thresholds and quotas, these attributes will not apply to that queue member. For more information about these attributes, see "JMS Distributed Queue -> Configuration -> Thresholds & Quotas" in the Administration Console Online Help.
Note: If you want to automatically create queue members on JMS servers that are part of a WebLogic Server cluster (for high availability) or on an single WebLogic Server instance that is not part of a cluster, see Creating a Distributed Queue and Creating Members Automatically.
Uniquely identify the distributed queue member within a WebLogic Server domain. |
|
Select the underlying physical queue that is associated with the distributed queue member. |
|
Define the weight (that is, a measure of ability to handle message load) of the queue member with respect to other queue members in the distributed destination. The random distribution load-balancing algorithm uses the weight assigned to the physical destinations to compute a weighted distribution for the set of physical destinations. For more information, see "Developing a WebLogic JMS Application" in Programming WebLogic JMS. |
Creating a JMS Distributed Queue Member
Follow these steps to add an existing physical queue as a member of distributed queue.
For more information about distributed queue member attributes, see "JMS Distributed Queue Member -> Configuration" in the Administration Console Online Help.
Deleting a JMS Distributed Queue Member
Follow these steps to delete a member of distributed queue configuration, and if necessary, to delete the queue member's underlying physical queue. For example, you must first delete a queue member from a distributed destination when planning to untarget or delete the JMS server that is hosting the member; otherwise, simply untargeting or deleting the JMS server can cause the configuration file (config.xml) to become unbootable.
Note: If you need to delete the entire distributed queue, then follow the directions for Deleting a Distributed Destination.
Creating a JMS Distributed Topic Member
Follow these steps to add an existing physical queue as a member of distributed queue.
For more information about distributed topic member attributes, see "JMS Distributed Topic Member -> Configuration" in the Administration Console Online Help.
Deleting a JMS Distributed Topic Member
Follow these steps to delete a member of distributed topic, and if necessary, to delete the topic member's underlying physical topic. For example, you must first delete a topic member from a distributed destination when planning to untarget or delete the JMS server that is hosting the member; otherwise, simply untargeting or deleting the JMS server can cause the configuration file (config.xml) to become unbootable.
Note: If you need to delete the entire distributed topic, then follow the directions for Deleting a Distributed Destination.
Deleting a Distributed Destination
If you need to delete an entire distributed destination, you must remove it in the following sequence:
Monitoring Distributed Destinations
When monitoring distributed destinations, you may see proxy topic members or system subscriptions, which are automatically created for the topic or queue members. For more information see, Monitoring Distributed Destination System Subscriptions and Proxy Topic Members.
Recovering from a WebLogic Server Failure
The following sections describe how to terminate a JMS application gracefully if a server fails and how to migrate JMS data after server failure.
You may want to program your JMS application to terminate gracefully in the event of a WebLogic Server failure. For example:
Migrating JMS Data to a New Server
WebLogic JMS uses the migration framework implemented in the WebLogic Server core, which allows WebLogic JMS to properly respond to migration requests and bring a WebLogic JMS server online and offline in an orderly fashion. This includes both scheduled migrations as well as migrations in response to a WebLogic Server failure.
Once properly configured, a JMS server and all of its destination members can migrate to another WebLogic Server within a cluster.
You can recover JMS data from a failed WebLogic Server by starting a new server and doing one or more of the tasks in the following table:
Note: JMS persistent stores can increase the amount of memory required during initialization of WebLogic Server as the number of stored messages increases. When rebooting WebLogic Server, if initialization fails due to insufficient memory, increase the heap size of the Java Virtual Machine (JVM) proportionally to the number of messages that are currently stored in the JMS persistent store and try the reboot again.
For information about starting a new WebLogic Server, refer to Starting and Stopping WebLogic Servers. For information about recovering a failed server, refer to Recovering Failed Servers in the Configuring and Managing WebLogic Domains guide.
For more information about migratable targets, see "Configuring WebLogic Migratable Services" in Using WebLogic Server Clusters.