I have done to build many applications related to messaging stuffs for the last 10 years, mostly an application that use for short message service ( SMS ) that delivered to the GSM Mobile phone. I think this is a time write all the experiments and share the snippet code that usually i have did mostly, and it became a pattern. Before jump into the code and practice stuffs, i would like to go the introduction concept about how to build application related to the messaging stuffs. The main key is a middle ware application as a main topic, because application it self need to have connectivity to transfer from and to the SMS Provider, and the application must serve the interaction to the user or third party application. And inside the application there shall be a router, queue, and worker module, this modules is a must requirement. For this explanation of the router, queue, and worker module, I would like to share about one book that explain deeply about them: Enterprise Integration Patterns ( EAIPatterns ) , you can find it in this link http://www.enterpriseintegrationpatterns.com/eaipatterns.html. This book will give you an explanation about what patterns that usually we faced to build messaging application. The messaging application is a module that have messaging oriented inside, the message can be inbound or outbound direction, and each message has its delivery status. The message content itself can be simple text, short message service (SMS), notification message, email message, etc. Process of the message can be asynchronous or synchronous mode, and all of them require queue and cache for the performance wise. And the delivery protocol that can be use such as simple http get post method, web service with SOAP, restful format, etc. Inside messaging application should has database to keep persistent the data traffic and/or data profile, queue and thread worker to perform delivery throughput, message converter, and support tools like log mechanism for debugging purpose. It also should have ui module to do the provision profile data and monitoring traffic including the report traffic. Mostly, there are 3 main modules inside the application: 1. Driver Module, this module will responsible to communicate with internal elements, each element has its own protocol but usually most of them were using standard / legacy protocol. 2. Router Module, this module is the core engine to pass the message that came from driver to adapter module or the opposite direction, this module also can handle the throughput of the running message, and intelligent to route the destination of the module. 3. Adapter Module, the module that communicate with external party app, and usually the third party app shall follow the legacy protocol that the adapter have.
Like in graph above, there are several drivers based on the legacy protocol that internal network elements provided, the message came from driver will pass to the router, and the router will decide to forward the messag into which adapter, and depend on the rules inside the router, each of the adapter will serve based on the protocol that required.