Immediate processing and sending
If you’re already familiar with the Auron SMS Server you’ll know how responsive it feels. Sending and processing messages all happens immediately.
This is because of the built-in ‘notification broker’. This notification broker lives in the Auron SMS Server service. It works together with the message bus to make processing immediate.
In the next section we explain more about the broker in context. To learn if this is something you need to know about skip to: ‘When do I use the broker API?‘.
The notification broker
The notification broker has two main purposes:
- It reduces unnecessary database access by removing the need to poll the database
- It makes message sending and processing immediate
This is a schematic representation of the notification broker:
On the left side of this schematic is an application that uses the Auron SMS Server API. On the right side there’s the SMS Server service that runs the broker. Since both sides live in their own process, socket communication is used between them.
The ‘App using API’ represents every application that needs immediate sending or processing. Those are:
- The SMS Server Manager
- The SMS Server Channels
- The Web Messenger
- Any custom application or script that uses the local API or direct database integration.
Notification broker or polling
The notification broker prevents the need for polling the database. However, there’s still a polling frequency configured in the server options. These are the ‘Check triggers interval’ and the ‘Check outgoing interval’ in the ‘processing’ tab.
This is how it works:
- Every cycle the service checks to see if there’s anything to do
- First it verifies if the polling intervals have expired
- Next it checks if the notification broker has any notifications
- If the broker has notifications it handles those and resets the polling intervals
- If the polling intervals expire it polls the database.
This means that if the polling intervals are wide enough and traffic is consistent enough, no polling ever occurs. It’s also possible to just disable polling altogether by setting the intervals to 0 in the server options. That way you’ll rely completely on the notification broker.
When do I use the broker API?
The broker API gives access to the message broker. In most cases this is done for you and there’s no need to use the broker API.
These are the cases when you don’t need to know about the notification broker and broker API:
- Using the SMS Server manager
- When only using trigger scripts and routing and/or blocking rules
- When using the HTTP REST API to integrate with the Auron SMS Server
- You’re OK with the poll frequency configured in the server options.
In these cases the Auron SMS Server makes sure that anything you do is handled immediately.
These are the cases when you do need to know about the broker API:
- You need maximum responsiveness and you’re integrating directly with the database
- You need maximum responsiveness and you’re using the local API outside of trigger scripts.
How to use the broker API
It’s easy to use the broker API. As seen in the schematic above there are two cases:
Listening for notifications
To listen for notifications you’ll first need to start listening. If you’re listening you can regularly check if there are status updates or non-status updates.
A status update means there’s either a new message or a change in the StatusID, TriggerStatusID or AckStatusID of a message.
A non-status update is fired for any change on any message.
Checking to see if there are status or non-status updates is very quick. This just checks some internal memory state and does not cause any database access.
Sending notifications
You can always send notifications. Just call NotifyStatusUpdate or NotifyNonStatusUpdate.
Notify a status update when there’s a new message to process or send, or if the status of an existing message was updated. A non-status update won’t trigger the service but will cause the message view in the SMS Server manager to update.
The best practice is to work in batches. For example: Add all messages you need to add before making a single call to ‘NotifyStatusUpdate’.
You can send notifications directly from the database as well. Find out more information about this here.
Technical considerations
To use the broker API you’ll need to have the Auron SMS Server installed. Setup an Auron SMS Server client configuration if you need the broker API on a client PC.
The notification broker sends socket data over port 16725. Sending notifications only requires UDP, listening only requires TCP.