Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle GlassFish Server Message Queue 4.5 Administration Guide |
Part I Introduction to Message Queue Administration
1. Administrative Tasks and Tools
3. Starting Brokers and Clients
6. Configuring and Managing Connection Services
Configuring and Managing Physical Destinations
Command Utility Subcommands for Physical Destination Management
Creating and Destroying Physical Destinations
Pausing and Resuming a Physical Destination
Purging a Physical Destination
Updating Physical Destination Properties
Viewing Physical Destination Information
Managing Physical Destination Disk Utilization
Managing Broker System-Wide Memory
Managing Durable Subscriptions
8. Configuring Persistence Services
9. Configuring and Managing Security Services
10. Configuring and Managing Broker Clusters
11. Managing Administered Objects
12. Configuring and Managing Bridge Services
13. Monitoring Broker Operations
14. Analyzing and Tuning a Message Service
17. Broker Properties Reference
18. Physical Destination Property Reference
19. Administered Object Attribute Reference
20. JMS Resource Adapter Property Reference
21. Metrics Information Reference
22. JES Monitoring Framework Reference
A. Distribution-Specific Locations of Message Queue Data
B. Stability of Message Queue Interfaces
This section describes how to use the Message Queue Command utility (imqcmd) to manage physical destinations. It includes discussion of a specialized physical destination managed by the broker, the dead message queue, whose properties differ somewhat from those of other destinations.
Note - In a broker cluster, you create a physical destination on one broker and the cluster propagates it to all the others. Because the brokers cooperate to route messages across the cluster, client applications can consume messages from destinations on any broker in the cluster. However the persistence and acknowledgment of a message is managed only by the broker to which a message was originally produced.
This section covers the following topics regarding the management of physical destinations:
Note - For provider independence and portability, client applications typically use destination administered objects to interact with physical destinations. Chapter 11, Managing Administered Objects describes how to configure such administered objects for use by client applications. For a general conceptual introduction to physical destinations, see the Message Queue Technical Overview.
The Message Queue Command utility (imqcmd) enables you to manage physical destinations interactively from the command line. See Chapter 16, Command Line Reference for general reference information about the syntax, subcommands, and options of the imqcmd command, and Chapter 18, Physical Destination Property Reference for specific information on the configuration properties used to specify physical destination behavior.
Table 7-1 lists the imqcmd subcommands for physical destination management. For full reference information about these subcommands, see Table 16-7.
Table 7-1 Physical Destination Subcommands for the Command Utility
|
The subcommand imqcmd create dst creates a new physical destination:
imqcmd create dst -t destType -n destName [ [-o property=value] … ]You supply the destination type (q for a queue or t for a topic) and the name of the destination.
Destination names must conform to the rules described below for queue and topic destinations.
Queue destination names must conform to the following rules:
It must contain only alphabetic characters (A–Z, a–z), digit characters (0—9), underscores (_), and dollar signs ($).
It must not contain spaces.
It must begin with an alphabetic character (A–Z, a–z), an underscore (_), or a dollar sign ($).
It must not begin with the characters mq.
For example, the following command creates a queue destination named XQueue:
imqcmd create dst -t q -n XQueueTopic destination names must conform to the same rules as queue destinations, as specified in Supported Queue Destination Names, except that Message Queue also supports, in addition, topic destination names that include wildcard characters, representing multiple destinations. These symbolic names allow publishers to publish messages to multiple topics and subscribers to consume messages from multiple topics. Using symbolic names, you can create destinations, as needed, consistent with the wildcard naming scheme. Publishers and subscribers automatically publish to and consume from any added destinations that match the symbolic names. (Wildcard topic subscribers are more common than publishers.)
The format of a symbolic topic destination name consists of multiple segments, in which wildcard characters (*, **, >) can represent one or more segments of the name. For example, suppose you have a topic destination naming scheme as follows:
size.color.shape
where the topic name segments can have the following values:
size: large, medium, small, ...
color: red, green, blue, ...
shape: circle, triangle, square, ...
Message Queue supports the following wildcard characters:
* matches a single segment
** matches one or more segments
> matches any number of successive segments
You can therefore indicate multiple topic destinations as follows:
large.*.circle would represent:
large.red.circle large.green.circle ...
**.square would represent all names ending in .square, for example:
small.green.square medium.blue.square ...
small.> would represent all destination names starting with small., for example:
small.blue.circle small.red.square ...
To use this multiple destination feature, you create topic destinations using a naming scheme similar to that described above. For example, the following command creates a topic destination named large.green.circle:
imqcmd create dst -t t -n large.green.circleClient applications can then create wildcard publishers or wildcard consumers using symbolic destination names, as shown in the following examples:
Example 7-1 Wildcard Publisher
... String DEST_LOOKUP_NAME = "large.*.circle"; Topic t = (Destination) ctx.lookup(DEST_LOOKUP_NAME); TopicPublisher myPublisher = mySession.createPublisher(t) myPublisher.send(myMessage);
In this example, the broker will place a copy of the message in any destination that matches the symbolic name large.*.circle
Example 7-2 Wildcard Subscriber
... String DEST_LOOKUP_NAME = "**.square"; Topic t = (Destination) ctx.lookup(DEST_LOOKUP_NAME); TopicSubscriber mySubscriber = mySession.createSubscriber(t); Message m = mySubscriber.receive();
In this example, a subscriber will be created if there is at least one destination that matches the symbolic name **.square and will receive messages from all destinations that match that symbolic name. If there are no destinations matching the symbolic name, the subscriber will not be registered with the broker until such a destination exists.
If you create additional destinations that match a symbolic name, then wildcard publishers created using that symbolic name will subsequently publish to that destination and wildcard subscribers created using that symbolic name will subsequently receive messages from that destination.
In addition, Message Queue administration tools, in addition to reporting the total number of publishers (producers) and subscribers (consumers) for a topic destination, will also report the number of publishers that are wildcard publishers (including their corresponding symbolic destination names) and the number of subscribers that are wildcard subscribers (including their symbolic destination names), if any. See Viewing Physical Destination Information.
The imqcmd create dst command may also optionally include any property values you wish to set for the destination, specified with the -o option. For example, the following command creates a topic destination named hotTopic with a maximum message length of 5000 bytes:
imqcmd create dst -t t -n hotTopic -o maxBytesPerMsg=5000See Chapter 18, Physical Destination Property Reference for reference information about the physical destination properties that can be set with this option. (For auto-created destinations, you set default property values in the broker’s instance configuration file; see Table 17-3 for information on these properties.)
To destroy a physical destination, use the imqcmd destroy dst subcommand:
imqcmd destroy dest -t destType -n destNameThis purges all messages at the specified destination and removes it from the broker; the operation is not reversible.
For example, the following command destroys the queue destination named curlyQueue:
imqcmd destroy dest -t q -n curlyQueue -u adminNote - You cannot destroy the dead message queue.
Pausing a physical destination temporarily suspends the delivery of messages from producers to the destination, from the destination to consumers, or both. This can be useful, for instance, to prevent destinations from being overwhelmed when messages are being produced much faster than they are consumed. You must also pause a physical destination before compacting it (see Managing Physical Destination Disk Utilization).
To pause the delivery of messages to or from a physical destination, use the imqcmd pause dst subcommand:
imqcmd pause dest [-t destType -n destName] [-pst pauseType]If you omit the destination type and name (-t and -n options), all physical destinations will be paused. The pause type (-pst) specifies what type of message delivery to pause:
Pause delivery from message producers to the destination
Pause delivery from the destination to message consumers
Pause all message delivery (both producers and consumers)
If no pause type is specified, all message delivery will be paused.
For example, the following command pauses delivery from message producers to the queue destination curlyQueue:
imqcmd pause dst -t q -n curlyQueue -pst PRODUCERS -u adminThe following command pauses delivery to message consumers from the topic destination hotTopic:
imqcmd pause dst -t t -n hotTopic -pst CONSUMERS -u adminThis command pauses all message delivery to and from all physical destinations:
imqcmd pause dst -u adminNote - In a broker cluster, since each broker in the cluster has its own instance of each physical destination, you must pause each such instance individually.
The imqcmd resume dst subcommand resumes delivery to a paused destination:
imqcmd resume dest [-t destType -n destName]For example, the following command resumes message delivery to the queue destination curlyQueue:
imqcmd resume dst -t q -n curlyQueue -u adminIf no destination type and name are specified, all destinations are resumed. This command resumes delivery to all physical destinations:
imqcmd resume dst -u adminPurging a physical destination deletes all messages it is currently holding. You might want to do this when a destination’s accumulated messages are taking up too much of the system’s resources, such as when a queue is receiving messages but has no registered consumers to which to deliver them, or when a topic’s durable subscribers remain inactive for long periods of time.
To purge a physical destination, use the imqcmd purge dst subcommand:
imqcmd purge dst -t destType -n destNameFor example, the following command purges all accumulated messages from the topic destination hotTopic:
imqcmd purge dst -t t -n hotTopic -u adminNote - In a broker cluster, since each broker in the cluster has its own instance of each physical destination, you must purge each such instance individually.
Tip - When restarting a broker that has been shut down, you can use the Broker utility’s -reset messages option to clear out its stale messages: for example,
imqbrokerd -reset messages -u adminThis saves you the trouble of purging physical destinations after restarting the broker.
The subcommand imqcmd update dst changes the values of specified properties of a physical destination:
imqcmd update dst -t destType -n destName -o property1=value1 [ [-o property2=value2] … ]The properties to be updated can include any of those listed in Table 18-1 (with the exception of the isLocalOnly property, which cannot be changed once the destination has been created). For example, the following command changes the maxBytesPerMsg property of the queue destination curlyQueue to 1000 and the maxNumMsgs property to 2000:
imqcmd update dst -t q -n curlyQueue -u admin -o maxBytesPerMsg=1000 -o maxNumMsgs=2000Note - The type of a physical destination is not an updatable property; you cannot use the imqcmd update dst subcommand to change a queue to a topic or a topic to a queue.
To list the physical destinations on a broker, use the imqcmd list dst subcommand:
imqcmd list dst -b hostName:portNumber [-t destType] [-tmp]This lists all physical destinations on the broker identified by hostName and portNumber of the type (queue or topic) specified by destType. If the -t option is omitted, both queues and topics are listed. For example, the following command lists all physical destinations on the broker running on host myHost at port number 4545:
imqcmd list dst -b myHost:4545Note - The list of queue destinations always includes the dead message queue (mq.sys.dmq) in addition to any other queue destinations currently existing on the broker.
If you specify the -tmp option, temporary destinations are listed as well. These are destinations created by clients, normally for the purpose of receiving replies to messages sent to other clients.
The imqcmd query dst subcommand displays information about a single physical destination:
imq query dst -t destType -n destNameFor example, the following command displays information about the queue destination curlyQueue:
imqcmd query dst -t q -n curlyQueue -u adminExample 7-3 shows an example of the resulting output. You can use the imqcmd update dst subcommand (see Updating Physical Destination Properties) to change the value of any of the properties listed.
Example 7-3 Physical Destination Information Listing
|
For destinations in a broker cluster, it is often helpful to know how many messages in a destination are local (produced to the local broker) and how many are remote (produced to a remote broker). Hence, imqcmd query dst reports, in addition to the number and total message bytes of messages in the destination, the number and total bytes of messages that are sent to the destination from remote brokers in the cluster.
For topic destinations, imqcmd query dst reports the number of publishers that are wildcard publishers (including their corresponding symbolic destination names) and the number of subscribers that are wildcard subscribers (including their symbolic destination names), if any.
To display metrics information about a physical destination, use the imqcmd metrics dst subcommand:
imqcmd metrics dst -t destType -n destName [-m metricType] [-int interval] [-msp numSamples]The -m option specifies the type of metric information to display:
ttl (default): Messages and packets flowing into and out of the destination and residing in memory
rts: Rate of flow of messages and packets into and out of the destination per second, along with other rate information
con: Metrics related to message consumers
dsk: Disk usage
The -int and -msp options specify, respectively, the interval (in seconds) at which to display the metrics and the number of samples to display in the output. The default values are 5 seconds and an unlimited number of samples.
For example, the following command displays cumulative totals for messages and packets handled by the queue destination curlyQueue:
imqcmd metrics dst -t q -n curlyQueue -m ttl -u adminExample 7-4 shows an example of the resulting output.
Example 7-4 Physical Destination Metrics Listing
|
For a more detailed description of the use of the Command utility to report physical destination metrics, see Physical Destination Metrics.
Because of the way message storage is structured in a file-based persistent data store (see File-Based Persistence Properties), disk space can become fragmented over time, resulting in inefficient utilization of the available resources. Message Queue’s Command utility (imqcmd) provides subcommands for monitoring disk utilization by physical destinations and for reclaiming unused disk space when utilization drops.
To monitor a physical destination’s disk utilization, use the imqcmd metrics dst subcommand:
imqcmd metrics dst -m dsk -t destType -n destMameThis displays the total number of bytes of disk space reserved for the destination’s use, the number of bytes currently in use to hold active messages, and the percentage of available space in use (the disk utilization ratio). For example, the following command displays disk utilization information for the queue destination curlyQueue:
imqcmd metrics dst -m dsk -t q -n curlyQueue -u adminExample 7-5 shows an example of the resulting output.
Example 7-5 Destination Disk Utilization Listing
|
The disk utilization pattern depends on the characteristics of the messaging application using a particular physical destination. Depending on the flow of messages into and out of the destination and their relative size, the amount of disk space reserved might grow over time. If messages are produced at a higher rate than they are consumed, free records should generally be reused and the utilization ratio should be on the high side. By contrast, if the rate of message production is comparable to or lower than the consumption rate, the utilization ratio will likely be low.
As a rule, you want the reserved disk space to stabilize and the utilization ratio to remain high. If the system reaches a steady state in which the amount of reserved disk space remains more or less constant with utilization above 75%, there is generally no need to reclaim unused disk space. If the reserved space stabilizes at a utilization rate below 50%, you can use the imqcmd compact dst subcommand to reclaim the disk space occupied by free records:
compact dst [-t destType -n destName]This compacts the file-based data store for the designated physical destination. If no destination type and name are specified, all physical destinations are compacted.
You must pause a destination (with the imqcmd pause subcommand) before compacting it, and resume it (with imqcmd resume) afterward (see Pausing and Resuming a Physical Destination):
imqcmd pause dst -t q -n curlyQueue -u admin imqcmd compact dst -t q -n curlyQueue -u admin imqcmd resume dst -t q -n curlyQueue -u adminTip - If a destination’s reserved disk space continues to increase over time, try reconfiguring its maxNumMsgs, maxBytesPerMsg, maxTotalMsgBytes, and limitBehavior properties (see Physical Destination Properties).
The dead message queue, mq.sys.dmq, is a system-created physical destination that holds the dead messages of a broker's physical destinations. The dead message queue is a tool for monitoring, tuning system efficiency, and troubleshooting. For a definition of the term dead message and a more detailed introduction to the dead message queue, see the Message Queue Technical Overview.
The broker automatically creates a dead message queue when it starts. The broker places messages on the queue if it cannot process them or if their time-to-live has expired. In addition, other physical destinations can use the dead message queue to hold discarded messages. This can provide information that is useful for troubleshooting the system.
The physical destination configuration property useDMQ controls a destination’s use of the dead message queue. Physical destinations are configured to use the dead message queue by default; to disable a destination from using it, set the destination’s useDMQ property to false:
imqcmd update dst -t q -n curlyQueue -o useDMQ=falseYou can enable or disable the use of the dead message queue for all auto-created physical destinations on a broker by setting the broker’s imq.autocreate.destination.useDMQ broker property:
imqcmd update bkr -o imq.autocreate.destination.useDMQ=falseYou can manage the dead message queue with the Message Queue Command utility (imqcmd) just as you manage other queues, but with some differences. For example, because the dead message queue is system-created, you cannot create, pause, or destroy it. Also, as shown in Table 7-2, default values for the dead message queue’s configuration properties sometimes differ from those of ordinary queues.
Table 7-2 Dead Message Queue Treatment of Physical Destination Properties
|
Tip - By default, the dead message queue stores entire messages. If you do not plan to restore dead messages, you can reduce the size of the dead message queue by setting the broker’s imq.destination.DMQ.truncateBody property to true:
imqcmd update bkr -o imq.destination.DMQ.truncateBody=trueThis will discard the body of all messages and retain only the headers and property data.
The broker configuration property logDeadMsgs controls the logging of events related to the dead message queue. When dead message logging is enabled, the broker will log the following events:
A message is moved to the dead message queue.
A message is discarded from the dead message queue (or from any physical destination that does not use the dead message queue).
A physical destination reaches its limits.
Dead message logging is disabled by default. The following command enables it:
imqcmd update bkr -o imq.destination.logDeadMsgs=trueNote - Dead message logging applies to all physical destinations that use the dead message queue. You cannot enable or disable logging for an individual physical destination.