MINI Sh3ll
#
# DLR with MySQL support configuration
#
# Example defining a MySQL database connection resource and
# the required table and field values.
#
group = mysql-connection
id = mydlr
host = localhost
username = foo
password = bar
database = dlr
# max count of connections that will be opened for dbpool
# default is 1
max-connections = 1
#
# Create the required table for the DLR support in the database
# with something similar like this:
#
# DROP TABLE IF EXISTS dlr;
# SET character_set_client = utf8;
# CREATE TABLE dlr (
# smsc VARCHAR(40) DEFAULT NULL,
# ts VARCHAR(65) DEFAULT NULL,
# destination VARCHAR(40) DEFAULT NULL,
# source VARCHAR(40) DEFAULT NULL,
# service VARCHAR(40) DEFAULT NULL,
# url VARCHAR(255) DEFAULT NULL,
# mask INT(10) DEFAULT NULL,
# status INT(10) DEFAULT NULL,
# boxc VARCHAR(40) DEFAULT NULL,
# KEY dlr_smsc_index (smsc),
# KEY dlr_ts_index (ts)
# ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc
#
# Advanced configuration for TTL (time-to-live) of DLR records:
#
# MySQL has no direct support for expiring rows in a table, unlike other Non-SQL
# counterparts like Redis or Cassandra. Therefore DLR entries in the table that
# have NEVER received any final DLR from the upstream SMSC will keep persistent
# in the table. The user needs to perform external clean-up procedures, i.e. by
# removing all entries that are older then a particular time interval using a
# cron job.
#
# We present here the concept of using MySQL 5.1+ internal events to clean-up
# the table. To enhance the configuration the following steps need to be
# performed:
#
# 1. Add a dlr.timestamp field sets the current timestamp automatically.
# Alter the table as follows:
#
# > ALTER TABLE dlr ADD COLUMN timestamp TIMESTAMP NOT NULL \
# DEFAULT CURRENT_TIMESTAMP AFTER boxc;
#
# Every entry is then "tagged" with the current timestamp, and can be
# evaluated for the clean-up process by this creation date.
#
# 2. Activate the event scheduler in MySQL:
#
# > SET GLOBAL event_scheduler = ON;
#
# [Reference: https://dev.mysql.com/doc/refman/5.5/en/events-configuration.html]
#
# 3. Create the event schedule itself for the DLR clean-up:
#
# > CREATE EVENT IF NOT EXISTS dlr_clean \
# ON SCHEDULE EVERY 6 HOUR \
# DO \
# DELETE FROM dlr WHERE TIME_TO_SEC(dlr.timestamp) + 604800 < TIME_TO_SEC(CURRENT_TIMESTAMP);
#
# Which creates an event, running every 6 hours (hence 4 times a day),
# deleting ANY records in the DLR table that are older then 7 days
# (604800 seconds). Adopt the schedule to your needs, i.e. avoiding
# clean-up at load peak times.
#
OHA YOOOO