Getting Started: Basic Config

Basic Config File:

<project>
    <profile name="profile1" hostname="machine1">
        <scheduler>
            <port>1222</port>
            <timeout>1000</timeout>
        </scheduler>

        <services>
            <service name="org.ib.service.cns.CNService">
                <port>1221</port>
                <config>cnsService-basic.xml</config>
            </service>
            <service name="org.ib.service.topic.TopicService">
                <port>1220</port>
            </service>
        </services>

        <clients>
            <client name="org.ib.service.cns.CNClient">
                <host>127.0.0.1</host>
                <port>1221</port>
            </client>
            <client name="org.ib.service.topic.TopicClient">
                <host>machine1</host>
                <port>1220</port>
            </client>
        </clients>

        <components>
            <component name="org.ib.gui.monitor.MonitorComponent">
                <port>1233</port>
                <scheduler>machine1:1222</scheduler>
                <subscribe>org.ib.bricks.Test1.debug@machine1:1234</subscribe>
                <subscribe>org.ib.bricks.Test2.debug@machine1:1235</subscribe>
                <subscribe>org.ib.bricks.Test2.debug@machine1:1236</subscribe>
                <subscribe>org.ib.bricks.Test1.heartbeat@machine1:1234</subscribe>
                <subscribe>org.ib.bricks.Test2.heartbeat@machine1:1235</subscribe>
                <subscribe>org.ib.bricks.Test2.heartbeat@machine1:1236</subscribe>
            </component>

            <component name="org.ib.bricks.Test1">
                <port>1234</port>
                <scheduler>machine1:1222</scheduler>
                <publish>StringData.Test1@test1</publish>
                <publish>StringData.Test2@test2</publish>
            </component>

            <component name="org.ib.bricks.Test2">
                <port>1235</port>
                <scheduler>machine1:1222</scheduler>
                <subscribe>StringData.Test1@machine1:1234</subscribe>
            </component>

            <component name="org.ib.bricks.Test2">
                <port>1236</port>
                <scheduler>machine1:1222</scheduler>
                <subscribe>StringData.Test2@machine1:1234</subscribe>
            </component>

            <component name="org.ib.component.SystemMonitorComponent">
                <port>1237</port>
                <scheduler>machine1:1222</scheduler>
                <subscribe>StringData.Test2@machine1:1234</subscribe>
            </component>
        </components>
    </profile>
</project>

Notes:

There are 4 important parts of the config file:

  1. The profile tag, defined under the name attribute. The profile has one hostname attached. For now we consider just a single machine configuration. For multiple machines and advanced configurations of the CNService please refer to Multiple Machines tutorial.
    <profile name="profile1" hostname="machine1">

    The profile name (profile1) is used by the command line tool start.sh (start.bat).

  2. The scheduler is one important component that provides the system with a synchronized heartbeat. It has a port associated so that the other components can connect.
    <scheduler>
      <port>1222</port>
      <timeout>1000</timeout>
    </scheduler>
    
  3. Services / Clients: We’ll leave the services and clients to the basic configuration for now. The CNService advanced configuration is described in the Multiple Machines tutorial.
  4. Components
    <component name="nameOfComponent">
      <port>portID</port>
      <scheduler>sMachineName:sPort</scheduler>
      <subscribe>subscribeTopic@machineName:port</subscribe>
      <publish>topic@internalTopic</publish>
    </component>
    
    • component name is the exact name of the Java class implementing the component, including the package name.
    • port is the unique port identifier of the component. It has to be a valid unused TCP port.
    • scheduler is the identification of the scheduler where the component should connect.
    • subscribe refers to the subscription topics. The subscription topics have to be previously publish by another component.
    • publish refers to all the external topics that are published by a component. An eternal topic is linked to an internal topic, which is a direct mapping to a specific data type. More details about subscribe and publish mechanism can be found in the Component Linking tutorial.