FirstSteps » History » Version 5

Version 4 (Anonymous, 07/24/2011 05:58 PM) → Version 5/8 (J. Moringen, 08/12/2011 03:59 AM)

h1. First Steps

h2. Introduction

After having installed RSB, trying some of the included example programs and generally making sure everything works as it should may be a good next step. This page describes some initial experiments that can be carried out after installing RSB.

h2. Starting RSB Programs

Currently, RSB uses "the Spread group communication framework":http://www.spread.org as its default network transport. Spread requires a dedicated daemon process to be running on at least one host of the network segment. Installation of the Spread libraries and daemon is explained on the [[Installation|installation page]].

# Starting the Spread daemon
If only a single machine is involved, the Spread daemon can be started using the following command:
<pre>
$ /SPREAD_INSTALL_PREFIX/sbin/spread -n localhost
/===========================================================================\
| The Spread Toolkit. |
| Copyright (c) 1993-2006 Spread Concepts LLC |
| All rights reserved. |
[...]
</pre>
# Starting an RSB Example Program
After the Spread daemon is running, connecting to it can be tested using one the example programs. For instance:
<pre>
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
Elapsed time for 1200 messages sent: 0.06 s
</pre>
If everything goes well, the output should look similar to the above. If the connection to the Spread daemon fails, the output will look similar to the following:
<pre>
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
1311067154364 rsb.spread.SpreadConnection [FATAL]: spread connect error: connection to spread daemon failed due to socket errors
SP_error: (-2) Could not connect. Is Spread running?
terminate called after throwing an instance of 'rsb::CommException'
what(): Error during connection to spread daemon
Aborted
</pre>

h2. Exchanging Events between two Processes

A more interesting experiment can be conducted by adding a receiving process. The easiest way to do this is using one shell for each process.

# Starting the Receiving Process
<pre>
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_listener
Listener setup finished. Waiting for messages on scope Scope[/example/informer/]
</pre>
# Starting the Informer Process
Like before:
<pre>
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
Elapsed time for 1200 messages sent: 0.06 s
</pre>

The @rsb_listener@ process should start to print lots of messages like
<pre>
blub
blub
[...]
</pre>

h2. Observing Events using the @rsblogger@ Program

Finally, it may be interesting to observe the actual events as they are sent over the network rather than just the output of the receiving process. This can be achieved using the @rsblogger@ tools.

# Starting the @rsblogger@ Process
<pre>
/RSB_CPP_TOOLS_SOURCE_DIRECTORY/build/logger/rsblogger --format detailed /
</pre>
*Note that the @rsblogger@ program is located in the @cpp/tools@ sub-project, not the @cpp/core@ sub-project.*
# Starting the Informer Process
Once again:
<pre>
$ /RSB_CPP_SOURCE_DIRECTORY/core/build/build/rsb_informer
Elapsed time for 1200 messages sent: 0.06 s
</pre>

The @rsblogger@ process should display output like the following:
<pre>
Event
Scope /example/informer/
Id 1b043ce7-0294-45a2-80d3-a43703b63986
Type std::string
Origin a5c937c8-e796-41ba-9c99-e5f2c4b94894
Timestamps
Create 2011-Jul-19 11:32:05.425828+??:??
Send 2011-Jul-19 11:32:05.425835+??:??
Receive 2011-Jul-19 11:32:05.441087+??:??
Deliver 2011-Jul-19 11:32:05.441143+??:??
Payload (std::string, length 4)
blup
</pre>

Note that it does not matter for this experiment whether there is a receiving process or not. The events will be sent and displayed in any case.

More information regarding RSB tools can be found on [[Tools|this page]].