Http Driver

A drive module for messaging gateway to support delivery data that came from http protocol.

It has driver terminology that came from drive acronym means that the module it self must comply with the legacy protocol provided by third party application, in this case is as an http web server.

It run only for http protocol as a base before it will represent as http get with query string data or http post with xml or json format, it depends how the legacy format that the web server provided.

As an module that built from java languange, it has internal API functions to provide service from other modules, the API is represent as Java Interface, and will came with the following 3 functions : sendMessage( Message message ) ; recvMessage( Message message ) ; recvStatus( Message message ) ; The sendMessage function is used for external module to send message , the recvMessage function is used to forward message from external module , and the recvStatus function is used to forward status of send message.

Please find the basic design of the driver module below

image

Inside the module there well be at least 3 workers : SendWorker, RespWorker, and RecvWorker. SendWorker is a submodule to handle all the send message that came from external module, accept it by store into the send queue or buffer, and send it all via http protocol with throughput mechanism. All the sent messages will forward to RespWorker, and this worker will accept it, store all the records into the transaction table. RecvWorker is a submodule to handle all the status outbound and inbound message, store into the queue or buffer, and forward to the external module.

All modules, including the http driver module, and all the submodule must have a legacy message data that can be understand thru all the functions, the legacy data message will found outside the module, because it doesn’t belong to specific module.

Please find the basic design of the SendWorker and RecvWorker

image

image

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.

diagram1

Introduction for the messaging application

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.

diagram1

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.

How to make intel galileo talks to the world

I have my Windows Laptop connected to internet thru Wifi, and the Intel Galileo Board is connected to the laptop thru Ethernet. But how to make the board is also connected to internet? Well i can share the wireless connection which connected thru internet to local connection. Just choose menu : Settings > Control Panel > Network Connections > Go to the connection that have internet connection > Properties > Tab Advanced > Check “Allow other network users to connect through this computer’s internet connection” > Select Local Area Network ( the one connect with Intel Galileo ) >  Uncheck “Allow other network users to control or disable the shared internet connection” > Ok, like the following image below

ShareInternet

Now, I need validate about my ip as a gateway for that board, and i need also my dns ip that usually use the same with the gateway ip, like the image below

ipconfig

In the local area network area, my laptop was set as 192.168.0.1, and this ip will use for Intel Galileo as a gateway. Ok, now i need to setup eth0 in my Intel Galileo, and i use Putty for the terminal to remote, like image below

setip

Ok, done. I can access the google now from my Intel Galileo.

Spark Core In Da House

image

My Spark Core just arrived, what a happy day. I will dig down anyd play with this new toy. It has 32bits 72MHz Arm Cortex M3, CC3000 Wifi Chip, 8pins Digital IO, 8pins Analog iO, 4pins PWM, and Arduino compatible thru UART USB Micro or Wifi. This is one of the easy embedded wireless development board, yeah.

Accessing Intel Galileo Board Via 3.5mm Serial Cable

The simplest thing to access Intel Galileo Board from Windows Laptop is by using UART 3.5mm Serial Connector that built in inside the board. It need 3.5mm Jack Serial Cable to DB9 Female, and continue with DB9 Male RS0232 Cable to USB Type A Plug. Like the following picture below :

IMG_20141124_163955

I bought the USB to RS232 Cable with brand “ATake”, inside they have chip “Prolific” as converter. In this case, I need to install the windows driver, and it available on their site http://www.atake.com/support.html. After the driver installation, it will shown in the device profiles as , like the following picture below :

20141124b

It named as “Profilic USB to Serial Com”, mine defined as COM19. From the COM selection, I can change the baud rate value, by right click and choose the properties like the following picture below

20141124c

I set the baud rate to the max 115200 , and the rest is still remain the same. Done, so far the serial cable is setup successfully, now its time to remote the board.

To remote the device, i just use the “Putty” application, and choose the Serial Connection, COM number 19 , and Baud Rate value 115200, and it will connected and require the login, by default the firmware set no root’s password.

20141124d

20141124e

Fin.