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

Attaching service providers



To be able to invoke a Service, a module must be declared as a provider to this Service, but it must also be attached to the Service.
  • By default if a Service has only one module provider, the framework will attach this module to the Service
  • All providers will be attached to event Services, even if there are more than one provider
  • Else if a Service has more than one provider, the framework will not attach any provider to this service by default. To attach one or more providers to the Service, you must declare the attached services explicitely with the attach attribute
To declare that a module is attached, you can use any of these values for the "attach" attribute:
  • "attach", "attached", "true"
To declare that a module is not attached, you can use any of these values for the "attach" attribute:
  • "detach", "detached", "false"

Services with only one provider

By default if a Service has only one module provider, the framework will attach this module to the Service. For example, in the following applications configuration, the publisher module is attached as a provider for the publish service:
      <applications>
         <application name="application">
            <modules>
               <module name="publisher">
                  <interfaces>
                     <publish service="publish" />
                  </interfaces>
               </module>
               <module name="subscriber">
                  <interfaces>
                     <subscribe service="publish" />
                  </interfaces>
               </module>
            </modules>
         </application>
      </applications>

Services with more than one provider

If a Service has more than one provider and the service is not an event Service, the framework will not attach any provider to this service. To attach one or more providers to the Service, you must declare the attached services explictely with the attach attribute. For example here the publisher1 and publisher2 modules are both attached as a provider for the publish service:
      <applications>
         <application name="application">
            <modules>
               <module name="publisher1"  >
                  <interfaces>
                     <push service="publish" attach="attach" />
                  </interfaces>
               </module>
               <module name="publisher2"  >
                  <interfaces>
                     <push service="publish" attach="attach" />
                  </interfaces>
               </module>
               <module name="subscriber" >
                  <interfaces>
                     <subscribe service="publish" />
                  </interfaces>
               </module>
            </modules>
         </application>
      </applications>
Note that if the framework property autoAttachProviders is set to true, it is not necessary to declare the attachment for each module. For example, if we have the following framework property declaration:
      <files>
      ...
         <property key="autoAttachProviders" value="true" />
      </files>
It is not necessary anymore to put any attach attribute for the modules interfaces.

Accepting multiple providers


By default only event Services allow to have multiple providers at the same time.

To change this behavior and allow publish Services and request-response Services to have multiple providers at the same time, you should set the acceptMultipleProviders framework property.

Attaching or detaching a provider

Main Article: Master modules

It is possible to attach or detach a module as a provider during runtime:
  • A master module is able to attach or detach any module in the framework
  • Other modules are only able to attach or detach themselves
For example:
      <applications>
         <application name="application" id="1">
            <modules>
               <module name="masterPublisher" id="1" >
                  <interfaces>
                     <push service="published" attach="attach" isMaster="true" />
                  </interfaces>
               </module>
               <module name="publisher2">
                  <interfaces>
                     <push service="published" attach="attach" />
                  </interfaces>
               </module>
               <module name="subscriber">
                  <interfaces>
                     <subscribe service="publish" />
                  </interfaces>
               </module>
            </modules>
         </application>
      </applications>
The methods to attach and detach a module to / from a Service are:

See also


Categories: concepts

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