The key log table

The message service uses a database table named key_log to control the processing of messages with duplicate key values. If you set the IGNORE_DUPLICATE_KEY option for the queue properties, or pass this option to the send or publish methods, EAServer must check for duplicate keys. To do so, the message service inserts the key to the key_log table, which has a unique index on the message key value and queue name. A failed insert indicates that the key is a duplicate.

The key_log table can grow large enough to affect database and message service performance. In this case, you should periodically remove entries that are old enough that the key is unlikely to be reused.

StepsTo control the size of the key log:

  1. Add a column to the key_log table using the database date type, such as datetime for Sybase databases. Modify the kl.create property in MessageServiceConfig.props so that the column is included when EAServer creates the table.

  2. Set the column default to the current date and time. For example, specify getdate() if using a Sybase database server. Specify the default in the database table schema, or modify the kl.create property in MessageServiceConfig.props to insert the value.

  3. Periodically run a database command to delete rows that are more than X days old, where X is a value determined heuristically to specify entries that are old enough that the key is unlikely to be reused. If you obtain message keys from an external system and forward them to the EAServer message service, consider the likelihood that the external system will send a message with the same key more than once.