EII Samples

EII samples apps demonstrate usage of EII core libraries

Steps to run EII samples apps

  1. Each sample app expects a set of config, interfaces & public private keys to be present in ETCD as a pre-requisite. To achieve this, please ensure an entry for a publisher-subscriber pair with its relative path from IEdgeInsights directory is set in any of the .yml files present in the IEdgeInsights directory. An example has been provided below:

AppContexts:
- Samples/cpp_sample_app/publisher
- Samples/cpp_sample_app/subscriber
- Samples/go_sample_app/publisher
- Samples/go_sample_app/subscriber
- Samples/python_sample_app/publisher
- Samples/python_sample_app/subscriber
  1. With the above pre-requisite done, please run the below command:

    $ cd [WORKDIR]/IEdgeInsights/build
    $ python3 builder.py -f ./usecases/<yml file used>
    
  2. Refer README.md to provision, build and run the Sample Apps

We have samples apps in C, golang and python as below:

Sample CPP APP for EII platform

‘Short Description of App containers’

The sample CPP application demonstrates the usage of EII core libraries like EIIMessageBus and ConfigManager. In this APP, there is a publisher,subscriber,client and server, subscriber-client and publisher-server are running, inside independent containers (container names are ia_cpp_publisher, ia_cpp_subscriber).

NOTEia_cpp_publisher container comprises of both publisher and server functionality.

ia_cpp_subscriber container comprises of both subscriber and client functionality.

The high level logical flow of Sample App is as below:

  1. Publisher contacts to ETCD service, using the cfgmgr library. It fetches it’s private key and allowed client’s public keys. Then it creates the publisher object and starts publishing the sample data at given topic (topic name : publish_test).

  2. Server contacts to ETCD service, and fetches it’s private key and allowed client’s public keys. Then it creates a server object according to given service name and waits for the client’s request.

    As mentioned in NOTE the publisher and server are running inside ia_cpp_publisher container.

  3. Subscriber contacts to ETCD service using the cfgmgr library. It fetches it’s private and public key and public key of publisher. It then creates the subscriber object (which subscribes to the same topic : publish_test) and start receiving the data and prints the same onto a console.

  4. Client contacts to ETCD service, and fetches its private key and public key of server. Then it creates a client object and sends a request to the server and gets the response back.

    As mentioned in NOTE the subscriber and client are running inside ia_cpp_subscriber container.

The sample Golang application demonstrates the usage of EII core libraries like EIIMessageBus and ConfigManager

Short Description of App containers

This is a Golang Application which uses the EII message bus and EII client side libraries. In this app, there is a publisher, subscriber, client and server. Subscriber and client are running inside ia_go_subscriber container. Publisher and server are running inside ia_go_publisher container.

The high level logical flow of Sample App is as below:

  1. Publisher contacts to ETCD service, using the ‘msgbusutil’ (IEdgeInsights/common/util/msgbusutil) library. It fetches it’s private key and allowed client’s public keys. Then it creates the publisher object and starts publishing the sample data at given topic(topic name: publish_test).

  2. Server contacts to ETCD service, and fetches it’s private key and allowed client’s public keys. Then it creates a server object according to given service name and waits for the client’s request.

  3. Subscriber contacts to ETCD service using the ‘msgbusutil’ (IEdgeInsights/common/util/msgbusutil) library. And fetches it’s private and public key and public key of publisher. It then creates the subscriber object(which subscribes to the same topic: publish_test) and starts receiving the data and prints the same onto a console.

  4. Client contacts to ETCD service, and fetches its private key and public key of server. Then it creates a client object and sends a request to the server and gets the response back.

Sample Python APP for EII platform

Short Description of App containers

This is a sample Python application which demonstrates the usage of EII core libraries like EIIMessageBus and ConfigManager.

In this app, there is a publisher, a subscriber a client and a server. Subscriber-client and publisher-server are running inside independent containers(container names are ia_python_publisher, ia_python_subscriber).

NOTE:

  1. ia_python_publisher container comprises of both publisher and server functionality.

  2. ia_python_subscriber container comprises of both subscriber and client functionality.

The high level logical flow of Sample App is as below:

1. Publisher contacts to ETCD service, using the 'msgbusutil'
   (IEdgeInsights/common/util/msgbusutil) library. It fetches it's private key
   and allowed client's public keys. Then it creates the publisher object and
   starts publishing the sample data at given topic(topic name: publish_test).

2. Server contacts to ETCD service, and fetches it's private key and
   allowed client's public keys. Then it creates a server object according
   to given service name and waits for the client's request.

As mentioned in NOTE, the publisher and server are running inside ia_python_publisher container.

3. Subscriber contacts to ETCD service using the 'msgbusutil'
   (IEdgeInsights/common/util/msgbusutil) library. And fetches it's private
   and public key and public key of publisher. It then creates the subscriber
   object(which subscribes to the same topic: publish_test) and starts
   receiving the data and prints the same onto a console.

4. Client contacts to ETCD service, and fetches its private key and public
   key of server. Then it creates a client object and sends a request to the
   server and gets the response back.

As mentioned in NOTE, the subscriber and client are running inside ia_python_publisher container.