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

Configure how event services datas are handled



By default event Services datas are handled in a background Thread by each subscriber when the notification is effective. It means that if the same event service is sent multiple times in rapid succession with different values for its datas, it is possible that the values seen by the subscribers will appear to always have the last value.

To avoid this it is possible to specify that datas are copied to an intermediary repository for each invocation before the notification Thread is called, ensuring that the datas will appear with their effective values even if the invocation has been performed multiple times in rapid succession.

This is possible to specify in two ways:

Problem overview

This is because the effective notification will happen "some time in the future"[1]
The "some time in the future" is usually only of the 10th of milliseconds type, so it will not have an impact in the vast majority of cases
after the provider has performed its invocation, which means the values can have already been updated when the notification is really applied.

Note that in the majority of cases it may not be a problem. For example events sent by the user when selecting an option will be sent at a time much greater than the time of the Thread to be executed in all cases.
eventsdataconf

Use case

To understand better this problem, suppose the following event Service:
      <services>
         <event name="setProperty" >  
            <data name="propertyID" type="string" />         
            <data name="propertyValue" type="int" />   
         </event >                  
      </services>
And the code invoking the service at the start of the provider module:
      public void start() {
        setPropertyService.setDataValue("propertyID", "property1");
        setPropertyService.setDataValue("propertyValue", 1);      
        setPropertyService.invoke();
      
        setPropertyService.setDataValue("propertyID", "property2");
        setPropertyService.setDataValue("propertyValue", 10);      
        setPropertyService.invoke();      
      }
In this case, in the default configuration of the framework, the subscriber will only see the values for the second invocation.

Examples

Configuration in the framework properties:
      <files>
      ...
         <property key="eventServicesCopyDatas" value="true" />
      </files>
Configuration for a specific event Service:
      <services>
         <event name="directTo" copyDatas="true" >  
            <data name="waypoint" type="int" />         
         </event >                  
      </services>

Notes

  1. ^ The "some time in the future" is usually only of the 10th of milliseconds type, so it will not have an impact in the vast majority of cases

See also


Categories: concepts

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