SQL polling technology
This guide gives information about how the polling system works in Ozeki NG SMS Gateway database user. The information provided can help in controlling and modifying the behaviour.
Default operationBy default, the system works the following way:
- You insert your messages into the Ozekimessageout database table with the status of "send"
- The Ozeki software reads these messages with an SQL select command and updates the status to "sending"
- After the status is updated to "sending", the Ozeki software puts these messages into the outbox queue.
- The Ozeki SMS engine takes the messages from the outbox queue and sends it to the mobile network.
- If the mobile network confirms, that it accepted the message for delivery, the status of the message in the database table is changed to "sent"
- If the mobile network rejects the message for any reason (e.g. there is no money on the subscription), the status is updated to "notsent".
- After the mobile network accepted the message for delivery, it tries to deliver the SMS to the recipient's mobile phone. If the SMS reaches the mobile phone, a delivery report is returned to the Ozeki NG software by the mobile network. When the delivery report is received, the Ozeki NG software updates the database record to "delivered" status. Please note, that it might be possible, that the delivery report comes in after several hours, or several days. This can happen for example if the recipient mobile phone is switched off.
- In some cases, the mobile network will not be able to deliver the SMS to the recipient's phone. For example if the recipient phone is never switched on. In this case, it will send an error report to Ozeki NG. If Ozeki NG receives this error report, it will update the status of the database record to "undelivered" in the ozekimessageout table.
What is polling and how does it work?
The term polling refers to the fact that Ozeki NG must check the ozekimessagout database table periodically for outgoing messages. The default polling mechanism works the following way:
Ozeki NG SMS Gateway executes an SQL SELECT statement on the database every 10 seconds (This is the polling interval). If it finds outgoing messages in the database table, it will take out a maximum of 10 messages for delivery (this is the maximum polling count). If the number of available messages for sending in the ozekimessagout database table is less then the maximum polling count, the software assumes that there are no more messages waiting to be sent, and will wait another 10 sec before checking again for new messages. If the number of available messages for sending in the ozekimessagout database table is more than the size of the maximum polling count, the software will execute another poll on the database immediately after the first poll is finished. This means that you don't have to worry about the length of the polling interval. If there are messages in the database, the Ozeki software will read them as fast as possible.
Controlling the maximum outbox size?
In some cases it might be possible, that there are several thousands, or even millions of messages waiting to be sent in your ozekimessageout database table. In this case, you probably don't want Ozeki NG to take all of them at once. To control the maximum number of messages in the Ozeki outbox, you can adjust the "MaxQueueSize" parameter in the C:\Program Files\Ozeki\OzekiNG - SMS Gateway\config\user-sql1.txt configuration file. Note that after adjusting this parameter, you will have to restart the Ozeki NG service.
If you adjust this parameter, Ozeki NG SMS Gateway will suspend polling temporarily if the outbox level reaches the specified limit. It will resume polling as soon as the outbox level goes below 80% of the specified limit.