Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

External Communication tutorial



In this tutorial, we will learn about using the External Communication module. We will reuse the first tutorial, and execute two framework instances:
  • The first framework instance will contain the eventAppli and a rerouting External Communication to communicate with the second instance
  • The second framework will contain the publishAppli and a rerouting External Communication to communicate with the first instance
Note that it is much better to use a network communication to communicate between two framework instances, but this tutorial allows to understand how the External Communication is working.

Overview

In the first tutorial, we had two modules:
  • The PublishModule module increments or decrements a value cyclically
  • The EventModule module allows to click on a toggle to set if the first module should increment or decrement the value, and shows the value
We will create two different Framework configurations to start two framework instances:
  • The first framework instance will contain the eventAppli and a rerouting External Communication to communicate with the second instance
  • The second framework will contain the publishAppli and a rerouting External Communication to communicate with the first instance

Architecture

We won't change anything for the services or types configuration of the first tutorial, but we will duplicate the EventModule in the applications configuration. We will have two framework instances in the eventAppli application: And two applications:
  • A first framework instance with the eventAppli application and a rerouting External Communication
  • A second framework instance with the publishAppli application and a rerouting External Communication
The eventAppli and publishAppli applications will have exactly the same implementation as our previous first tutorial:
externalcommtutorial

XML configuration

Event framework instance

The first framework instance contains the eventAppli application and a rerouting External Communication.

Applications configuration

      <applications>
         <application name="eventAppli">
            <deployment>
               <lib url="samplesEvents.jar" />
            </deployment>
            <modules>
               <module name="EventModule"> 
                  <implementation path="org.da.samples.protoframework.event.EventModule" >
                     <initEntryPoint method="init" />
                     <defaultReceiveEntryPoint method="subscribe" />
                  </implementation>
                  <interfaces>
                     <eventSend service="event"/>
                     <subscribe service="published" />
                  </interfaces>             
               </module>
            </modules>
         </application>  
         <application name="externalCommEvent">
            <deployment>
               <lib url="externalComm.jar" />
            </deployment>
            <modules>
               <module name="externalComm"> 
                  <interfaces>
                     <eventReceived service="event"/>
                     <push service="published"/>
                  </interfaces>             
               </module>
            </modules>
         </application>        
      </applications>

Network configuration

The network configuration for the External Communication will be:
      <network>
         <channel name="event" type="input" port="8080" >
            <service name="published" />
         </channel>  
         <channel name="publish" type="output" port="8081">
            <service name="event" />     
         </channel>
      </network>

Framework properties

The properties XML file for the first framework instance will be:
      <properties>
         <application name="externalCommEvent" >
            <module name="externalComm" >
               <moduleProperty key="network" value="networkEvent.xml" />        
            </module>
         </application>
      </properties>

Publish framework instance

The second framework instance contains the publishAppli application and a rerouting External Communication.

Applications configuration

        <applications>     
         <application name="publishAppli">
            <deployment>
               <lib url="samplesPublish.jar" />
            </deployment>
            <modules>
               <module name="PublishModule"> 
                  <implementation path="org.da.samples.protoframework.publish.PublishModule" >
                     <initEntryPoint method="init" />
                     <defaultReceiveEntryPoint method="subscribe" />
                     <defaultSendEntryPoint method="publish" /> 
                  </implementation>
                  <interfaces>
                     <eventReceived service="event"/>
                     <cyclic service="published" frequency="200ms" attach="attach"/>
                  </interfaces>             
               </module>
            </modules>
         </application>
         <application name="externalCommPublish">
            <deployment>
               <lib url="externalComm.jar" />
            </deployment>
            <modules>
               <module name="externalComm" > 
                  <interfaces>
                     <eventSend service="event"/>
                     <subscribe service="published"/>
                  </interfaces>             
               </module>
            </modules>
         </application>            
      </applications>

Network configuration

The network configuration for the External Communication will be:
      <network>
         <channel name="event" type="output" port="8080" >  
            <service name="published" />
         </channel>  
         <channel name="publish" type="input" port="8081">   
            <service name="event" />     
         </channel>
      </network>

Framework properties

The properties XML file for the second framework instance will be:
      <properties>
         <properties>
            <application name="externalCommPublish" >
               <module name="externalComm" >
                  <moduleProperty key="network" value="networkPublish.xml" />        
               </module>
            </application>
         </properties>

Filelist configuration

Each XML filelist configuration refer to the files defined for the associated framework.

For the Event framework instance:
      <files>
         <file url="applicationsEvent.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <file url="propertiesEvent.xml" />
      </files>
For the Publish framework instance:
      <files>
         <file url="applicationsPublish.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <file url="propertiesPublish.xml" />
      </files>

Starting the two frameworks

To start the two frameworks we must start each framework with the appropriate filelist file:
      java -jar protoframework.jar config=<filelist file>


tuto1

See also


Categories: builtin-applis | tutorials

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence