Permanent destinations are message queues or topics whose configuration properties are stored in a database. You can create permanent destinations two ways. The recommended way is to use EAServer Manager to create and configure message queues and topics. See Chapter 8, “Setting up the Message Service,” in the EAServer System Administration Guide for information on how to do this. You can also create permanent destinations using the JMS APIs createQueue and createTopic. Sybase suggests that you use this option only when client applications need the ability to dynamically change the provider-specific destination name; applications using this technique are not portable.
When you create message queues and topics using EAServer Manager, client applications can use their InitialContext object to look up the destinations; for example:
// Look up a message queue javax.jms.Queue queue = (javax.jms.Queue) ctx.lookup(“MyQueue”); // Look up a topic javax.jms.Topic topic = (javax.jms.Topic) ctx.lookup(“MyTopic”);
To create permanent destinations using the JMS APIs, you must first create a session; see “Creating sessions” for details. Once you have access to a session object, use this syntax to create a destination:
javax.jms.Queue queue = queueSession.createQueue(“MyQueue”); javax.jms.Topic topic = topicSession.createTopic(“MyTopic”);
You can also create temporary destination objects that are active only during the lifetime of a session. When the session is closed, temporary destination objects and their associated messages are discarded. These two lines illustrate how to create temporary message queue and topic destinations:
// Create a temporary queue javax.jms.Queue queue = queueSession.createTemporaryQueue(); // Create a temporary topic javax.jms.Topic topic = topicSession.createTemporaryTopic();
By default, temporary message queues time out after 60 seconds of inactivity. To increase this value, you can do one of two things:
Set the connection factory’s CONFIG_QUEUE property to the name of a message queue with a reasonably high timeout value. Subsequently, each temporary message queue you create that uses this connection factory inherits the properties of the queue assigned to CONFIG_QUEUE.
Set the value at the global level so all temporary
message queues use the same timeout value. To do this, edit the MessageServiceConfig.props file, located
in the EAServer /Repository/Component/CtsComponents directory,
and set the session.timeout
property
to the appropriate number of seconds.
Chapter 8, “Setting up the Message Service,” in the EAServer System Administration Guide describes these settings in detail.
Copyright © 2005. Sybase Inc. All rights reserved. |