Adding the support for a new middleware to MORSE

Adding a datastream manager

When you want to add a new middleware to MORSE, you need first to create a ‘datastream’ manager. Basically, its role is to make the link between components and datastream handler. From an implementation point of view, it must be a subclass or morse.core.datastream.DatastreamManager. In addition to classic method __init__ and __del__, you may want to override the method morse.core.datastream.DatastreamManager.register_component() which really includes the logic of registration. However, in general, the default implementation is enough. You can find some example of overloading in morse.middleware.socket_datastream.Socket.register_component() where we store additional informations for the sake of different services.

If you need to run some general datastream/middleware code once by simulation turn, you can also override the morse.core.datastream.DatastreamManager.action`() method.

Module Organisation

To match the MORSE organisation, we expect the following file hierarchy:

  • in morse.middleware, a file <your_middleware> which contains the datastream manager for your middleware.
  • in morse.middleware.your_middleware, a set of files implementing different datastream handler (see Adding a new datastream handler) for different messages. It is recommended to abstract generic handling of your middleware in two base class (Publisher and Reader).

The builder part

To facilitate the use of your middleware, you can add some entries in In particular, you need to add an entry for your datastream manager in, and add the necessary entries for the different datastream handler in

Table Of Contents

Previous topic

Understanding Morse code organisation

Next topic

Adding new service

This Page