NonStop JMS User's Manual (NonStop JMS 2.0+)

NSJMS and JMS Client Applications
NonStop Server for Java Message Service User’s Manual522356-002
3-13
Message Expiration Values
threaded programs which use separate threads to receive messages simultaneously
from different sources or to perform processing while awaiting messages.
The system property sqlmx_nowait toggles the non-blocking function. The default
value is off. sqlmx_nowait can be set from the command line by using the -D option
(-Dsqlmx_nowait=on|off) or programmatically, before obtaining the first NSJMS
connection, by using the System.setProperty() method.
The sqlmx_nowait value is obtained from the environment only at the time of the first
JDBC/MX connection. The JDBC/MX driver is then configured with the value of the
sqlmx_nowait system property for any subsequent connections within the same
JVM.
After initiating the receive operation, NSJMS yields the thread control to the JVM.
When a message arrives, the JVM wakes up the thread and returns the message to
the application.
If sqlmx_nowait is set to on, users may want to set the Database.timeout value
to 1000+ milliseconds so the thread waits on messages for a longer period. The larger
timeout value can improve performance because the SQL operation is stopped and
restarted less frequently while awaiting a message; the longer timeout will not block the
process since other threads will run during the time spent waiting for the message.
Message Expiration Values
The application determines the rate of removal for messages in queues, which are
deleted as they are received. Messages in queues might also have expiration
attributes, that specify that the messages can be removed before they are received.
Messages on topics are not removed by subscribers, so they exist until they are
removed based on the messages expiration value. Expiration values are specified
when messages are sent; otherwise, the default is for the message to never expire.
For topics, this default would mean that a message remains on the database until the
topic is deleted by an administrative command.
You can change the default expiration value for a message sent to a destination by
specifying a value for the expiry attribute in the ADD command. The expiry attribute
sets the default expiration value for a message to a specified number of milliseconds
(see ADD Command on page 5-2).