7.8.4 Management information and message persistence services

If an error occurs in CJMSP Broker, the information that indicates the status of the message sending and receiving operations before the error occurred is required for recovery. With CJMSP Broker, the status information required for recovery is stored and managed in files. If an error occurs, you can recover the status of CJMSP Broker on the basis of the stored information and restart the operations, thereby ensuring a reliable message delivery.

CJMSP Broker stores and manages the following information in files:

If you restart CJMSP Broker after an error, based on the stored information, the destination and persistence subscriber are re-created, the persistence messages are recovered, the transaction is rolled back, and the route is re-created for the un-delivered messages. Thereafter, the delivery of messages is restarted.

Organization of this subsection
(1) Mechanism of management information and message persistence
(2) Using the file pool
(3) File write timing
(4) File storage destination
(5) File backup

(1) Mechanism of management information and message persistence

CJMSP Broker creates and manages files for each type of information to be perpetuated. The storage files are automatically created when CJMSP Broker is created. The storage destination files differ for each information type.

The messages with sizes no more than the threshold value (1 MB) are stored in one variable length file per message. Also, the messages with sizes exceeding the threshold value are managed with multiple files in the file pool. The size of each file in the file pool is 1 MB.

(2) Using the file pool

The following figure provides an overview of the file pool managed by CJMSP Broker.

Figure 7-11 Overview of the file pool managed by CJMSP Broker

[Figure]

The features of the file pool are as follows:

(3) File write timing

You write data to a file using the OS functionality. At this time, you can select whether to write synchronously or asynchronously with the imq.persist.file.sync.enabled property. Note that asynchronous writing is implemented by default.

The following table describes the advantages and disadvantages of synchronous writing and asynchronous writing.

Table 7-6 Advantages and disadvantages of synchronous writing and asynchronous writing in files

Write timingAdvantagesDisadvantages
AsynchronousThe processing performance is not affected by the write processing.If an error occurs, some of the data might be lost.
SynchronousThe data until the point when error occurs is stored, so you can restart the processing of CJMSP Broker from the status just before the error occurred.The processing performance is affected by the write processing.

(4) File storage destination

The files storing the persistence data managed by CJMSP Broker are stored in the following directory by default. Note that you can change the storage destination of the var directory, with the -varhome option of the cjmsbroker command.

In Windows

Cosminexus-installation-directory\CC\cjmsp\var\instances\CJMSP-Broker-name\fs370

In UNIX

/opt/Cosminexus/CC/cjmsp/var/instances/CJMSP-Broker-name/fs370

The following table describes the configuration beneath the fs370 directory.

Table 7-7 Configuration beneath the fs370 directory

Directory or file nameExplanation
message directoryA sub-directory is created for each destination beneath this directory. An individual file for each message is stored in each sub-directory.
interest fileThis file stores the consumer information.
destination fileThis file stores the destination information.
property fileThis file stores the internal information.
txn fileThis file stores the transaction ID.
txnack fileThis file stores the delivery confirmation for all the transaction IDs.
configrecord fileThis file stores the internal information.

Manage the contents of this directory appropriately by setting up permissions, such as the OS access permissions, so as to prevent unauthorized access.

Note
  • Do not move the files beneath the fs370 directory and do not change the file attributes to read only. CJMSP Broker might not operate correctly.
  • You cannot use the network drives or the files on the network. To change the storage destination of the var directory with the -varhome option of the cjmsbroker command, make sure you select a directory on the same computer as CJMSP Broker.
  • If you process a large amount of messages in one transaction, the size of the txnack file might increase greatly. To send a large amount of messages, implement a performance test to estimate the required file size.

(5) File backup

You obtain the backup of the persistence data for each CJMSP Broker. Copy and store the instances directory that is beneath the var directory at another location.

To recover from an error, stop CJMSP Broker first. Overwrite the backed up files in the instances directory on to the var directory, and then restart CJMSP Broker.