Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simple Configuration Example

germanescobar edited this page Oct 25, 2012 · 10 revisions

Suppose that you have an application that needs to send messages to an SMSC (e.g. a mobile operator) but you don't want to implement an SMPP client and decide to use Mokai as a bridge between your application and the SMSC. The application will send HTTP messages to Mokai, which will route them to the SMSC as shown in the following figure:

Simple Configuration

First, we need to configure the Jetty Connector that will listen to the HTTP requests from the application. The <MOKAI_HOME>/conf/applications.xml file is the place where you configure this:

<connectors xmlns="http://mokai.googlecode.com/connectors"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://mokai.googlecode.com/connectors http://mokai.googlecode.com/svn/schema/connectors-0.5.xsd">
 
    <connector id="jetty-test" className="org.mokai.connector.jetty.JettyConnector">
        <configuration>
            <property name="port">9080</property>
        </configuration>
    </connector>
 
</connectors>

Here we are defining a Jetty Connector with id "jetty-test" configured to listen on port 9080 and in the root context "/".

Now we need to configure the SMPP Connector that will be connected to the SMSC. The <MOKAI_HOME>/conf/connections.xml file is the place to configure it:

<connectors xmlns="http://mokai.googlecode.com/connectors"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://mokai.googlecode.com/connectors http://mokai.googlecode.com/svn/schema/connectors-0.5.xsd">
 
    <connector id="smpp-test" className="org.mokai.connector.smpp.SmppConnector">
        <configuration>
            <property name="host">localhost</property>
            <property name="port">8321</property>
            <property name="systemId">test</property>
            <property name="password">test</property>
        </configuration>
        <acceptors>
            <acceptor className="org.mokai.acceptor.AcceptAllAcceptor" />
        </acceptors>
    </connector>
 
</connectors>

As you can see, we are defining the SMPP Connector with the id "smpp-test". The configuration is pretty straight forward (don't forget to change it with the values that the SMSC administrator gives you). We are also telling Mokai that this connector will accept all messages (as we'll see in other examples, you can decide which messages are routed to each connector).

You can now start the Mokai Gateway and open the Web Admin Console at http://localhost:8383/. Login and check that you are connected to the SMSC. You should see something like this:

Mokai Admin Web Console

You can now test the configuration by pointing your browser to http://localhost:9080/?to=573004873733&from=2222&text=Prueba1 and checking the Messages tab in the Web Adminisration Console.

Related Content

Clone this wiki locally