Simple Messaging Gateway

Before jump to the bigger and complex messaging platform, it would be nice if we have build a simple messaging gateway. The purpose of this application is to responsible the delivery message that came from http sender to http listener. Ok, now start with design, the gateway application required at least a driver/adapter http module to translate the message, a router module to do the messaging routing, and the message itself. The message data structure contains several main fields like message unique id, original node, destination node, original address, destination address, and message content. The node field can refer to the name of http module that we are going to build, this module can be instance into several objects, but the router object can only have one, and it will handle all the messages from/to object modules. Inside the router module shall have capability to restrict the message throughput, that’s why it needs a duo queue as inbound and outbound queue, several thread workers to process message from inbound queue to outbound queue. Inside the http module shall have capability to convert message into http message and the other way around, it requires the http client library to support and http embedded web server. For the support mechanism, we should put the log library as well, and write every messaging activities into the log, in this application we don’t provide the User Interface module, and all the initial parameters will held in the configuration file that stored into XML format. This application also run under Java Runtime, we can use version 7 the latest and stable one.

Like the example xml file configuration above, explained that the platform has 4 modules, first the driver module, is that handle the low level protocol like http, smtp, etc. Second is node module, this module is just as representative of driver inbound and outbound , and it also forward all the inbound message to router module. The third is router module, this module will responsible to route each of the message based on the script inside to which destination node. The forth is processor module, this module is as route scripting module for router module. In this example, the processorHttpSimple will route the message based on the map properties that defined in the existing configuration xml file.