EXAMPLES

Durability

1) Description

The durability example illustrates the ability of late joining readers to obtain data that has already been published before these readers were created.

2) Design

It consists of 2 units :

3) Scenario

The DurabilityDataPublisher application write 10 samples and wait for user input to terminate the application. Three possibilities are offered (configurable via arguments passed by command line cf.5):

IMPORTANT : for persistence to work correctly, the configuration file should define a store type and a store location (use the configurator tool to do that).

Run the DurabilityDataSubscriber Application. It will receive the 10 samples written by the DurabilityDataPublisher and display their content.

Configurable:

durability_kind allows one of two values

autodispose_flag allows one of two values

automatic_flag allows one of two values

Running of examples

Usage

DurabilityDataPublisher usage:
          DurabilityDataPublisher [durability_kind] [autodispose_flag] [automatic_flag]
        
DurabilityDataSubscriber usage:
          DurabilityDataSubscriber [durability_kind]
        

Running the examples in a Posix environment

Environment Setup

Let's call OpenSplice_install_dir the OpenSplice installation directory.

The OpenSplice environment variables must be set in order for the examples to build/run correctly. To do this, open a terminal and source the "OpenSplice_install_dir/release.com" script supplied with the distribution.

C Executables

Building the examples is described on the Summary page

Two executables are generated in the bin directory when the example is built:

For C

Java5 executables

Building the examples is described on the Summary page

Two jars are generated in the java5 directory when the example is built:

For Java5

ISO C++ 2 Executables

Building the examples is described on the Summary page

Two executables are generated in the bin directory when the example is built:

Running the example

Ensure that the environment for OpenSplice is set up correctly as described above for each new terminal used.

It is recommended that you run the subscriber and publisher in separate terminals to avoid mixing the output

Running in single process (heap memory) configuration : the application starts OpenSplice middleware

Running in multiple process shared memory configuration

To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir/etc/config directory.

Running the subscriber and publisher

Scenario 3.1 :
Scenario 3.2 :
  • Run the Subscriber Application, in a console go to the example directory as described above and start the subscriber
  • Run the Publisher Application,in a console go to the example directory as described above and start the publisher
  • Stop the Publisher Application
  • Run another instance of Subscriber Application as described above and check that it receives the samples.
  • Stop the subscribers
  • Scenario 3.3 :

    (If running in Shared Memory deployment we need to stop/start openSplice as we will change the topic durability kind from Transient (in scenario 3.2) to Persistent. Otherwise we won't be able to create the topic)

    Running C/C#/ISO C++ 2/Java5 examples on Windows

    Environment Set up

    Let's call OpenSplice_install_dir the OpenSplice installation directory.

    The OpenSplice environment variables must be set in order for the examples to run correctly. To do this open an OpenSplice Command Prompt which will set up the environment variables for OpenSplice automatically. The OpenSplice Command Prompt can be selected from the launcher. Alternatively, open a windows Command Prompt and execute the "OpenSplice_install_dir\release.bat" batch script supplied with the distribution.

    C/C# Executables

    Building the examples is described on the Summary page

    Two executables are generated in the examples build/bin directory when the example is built:

    For C

    For C#

    Java Executables

    Building the examples is described on the Summary page

    Two jars are generated in the java5 directory when the example is built:

    For Java5

    ISO C++ 2 Executables

    Building the examples is described on the Summary page

    Two executables are generated in the bin directory when the example is built:

    Running the C/C#/ISO C++ 2/Java5 Examples

    Ensure that the environment for OpenSplice is set up correctly as described above for each new command prompt used.

    The following steps describe how to run the examples:

    Running in single process (heap memory) configuration : the application starts OpenSplice middleware

    Running in multiple process shared memory configuration

    To enable deployment in this mode, an OpenSplice configuration file must be selected that has shared memory support e.g. one of the ospl_shmem xml configuration files found in the OpenSplice_install_dir\etc\config directory.

    Running the subscriber and publisher

    Usage :
    Scenario 3.1 :
    Scenario 3.2 :
  • Run the Subscriber Application, in a console go to the example directory as described above and start the subscriber
  • Run the Publisher Application,in a console go to the example directory as described above and start the publisher
  • Stop the Publisher Application
  • Run another instance of Subscriber Application as described above and check that it receives the samples.
  • Stop the subscribers
  • Scenario 3.3 :

    (If running in Shared Memory deployment we need to stop/start OpenSplice as we will change the topic durability kind from Transient (in scenario 3.2) to Persistent. Otherwise we won't be able to create the topic)

    Using Dlite as Durability Service

    Dlite is the next generation improved durability service that complies with DDS Persistence Profile. It is possible to use Dlite instead of current durability service by simply using empty DLite element in the configuration:

    Persistency is disabled by default; you can enable it with the following:

    You can use the configuration file - $OSPL_HOME/etc/config/ospl_sp_ddsi_dlite.xml - to run the durability examples with DDSI and Dlite.

    Add Persistency element in DLite configuration to run examples with persistent topics