nServiceBus Case Study – Inbound SMS Processing

We have been using nServiceBus in production for over 6 months now, we have had a very positive experience, so I wanted to show how we have been using it with some real world examples. One implementation we have just released handles inbound SMS messages and checks the sender’s number to see if they are an existing or new customer then reacts accordingly.

1) Our SMS provider calls our http handler (hosted in IIS) each time an inbound SMS is recieved.
2) The http handler calls the SmsGateway via a WCF service, which in turn publishes an InboundSmsMessage to the bus.
3) The Subscriber receives the InboundSmsMessage it interrogates the database to see if this is an exising customer or not.
4) Finally is sends a command to the worker service depending on whether this is an existing customer or not.
5) If the SMS is not from an existing customer then the worker initiates a call between the number and a CS agent.

Benefits of this approach

If their is a sudden surge in inbound Sms messages due to a successful advertising campaign we can control processing to avoid degrading overall system performance. We could further isolate our message processing from the core system by creating a cache on the Subscriber of all existing customer’s mobile numbers. This cache could be kept up to date by the publishing new customer messages.

If other services need to know about inbound SMS message say for invoice reconcilliation or just marketing reports they can subscribe to the messages and aggregate them. This can be done in realtime to allow the marketing team access to a dashboard that provides feedback on the effectiveness of their campaigns.

The most obvious benefit is that the Sms Gateway is autonomous, and the services that subscribe to the inbound messages need no understanding of what an SMS message is or it’s semantics.

We have since realised that our implementation is not optimal, we are going to host NServiceBus in IIS and send and Inbound message notification to the SMS Gateway service and remove the WCF piece.