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.
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.
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
The features of the file pool are as follows:
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 timing | Advantages | Disadvantages |
---|---|---|
Asynchronous | The processing performance is not affected by the write processing. | If an error occurs, some of the data might be lost. |
Synchronous | The 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. |
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.
Cosminexus-installation-directory\CC\cjmsp\var\instances\CJMSP-Broker-name\fs370
/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 name | Explanation |
---|---|
message directory | A sub-directory is created for each destination beneath this directory. An individual file for each message is stored in each sub-directory. |
interest file | This file stores the consumer information. |
destination file | This file stores the destination information. |
property file | This file stores the internal information. |
txn file | This file stores the transaction ID. |
txnack file | This file stores the delivery confirmation for all the transaction IDs. |
configrecord file | This 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.
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.