NonStop JMS C++ API Programmer's Guide
Using the NSJMS C++ APIs
NonStop Server for Java Message Service C++ API Programmer’s Guide—526459-002
5-8
Sending a Message
this expiration value is converted to a Julian timestamp and stored in the
msg_expiration column of the MESSAGE table. The conversion algorithm is:
julian = (millis + MILLIS_TILL_1970) * 1000;
where MILLIS_TILL_1970 is 210866760000009.
If the time-to-live value is 0, then the message remains in the database forever, or until
it is deleted by a queue receiver or manually deleted. The two send() methods that
do not include time-to-live as an argument use the value assigned to the
DEST_EXPIRY column of the DEST table as the default time-to-live value.
Queue Message Removal
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.
Topic Message Removal
Messages on topics are not removed by subscribers. The messages exist until they
are removed because they have expired or are dead.
A topic message is expired when the message-expiration value is exceeded. An
expiration value is specified when the message is sent. If no expiration value is
specified, the message never expires.
A topic message is dead after it has been read by all subscribers.
To remove expired and dead messages, do either of these:
Use the NSJMS administrative utility DELETE command.
Set the Deadmsg.deletecount property in the nsjms.property file to a value
greater than 0. This value represents the number of messages received between
the deletion of dead messages. For example, a delete count of 100 means that
after every 100th message received from a topic, all existing dead messages are
deleted. Setting the Deadmsg.deletecount property to 0 disables
dead-message removal.
Free Producer Resources
The Session class contains the freeProducer() method for freeing producer
resources. This method takes a pointer to a Producer object as an argument. This
method results in the Producer destructor being called, which frees all memory used by
the Producer.
Freeing a producer is shown in this code fragment:
//Freeing the producer
pSes->freeProducer(pProducer);