Next: , Previous: , Up: Individual Armour cases   [Contents]


7.3.7 ArmourMSOE (MissingSynchronousOutEvent)

The context is expected to generate out-event via requires interface but may not do that. The system diagram shows the armour at the requires port of the Dezyne component:

ArmourMSOE

We only deal with one void in-event and one void out-event. The Strict interface specifies that an in-event must lead to a synchronous out-event.

interface IStrict
{
  in void ia();
  out void oa();

  behaviour
  {
    on ia: oa;
  }
}

The Robust interface allows that an in-event either or not sends a synchronous out-event.

interface IRobust
{
  in void ia();
  out void oa();

  behaviour
  {
    on ia: oa;
    on ia: {}
  }
}

In the armour we use a combination of async and blocking. We need blocking to make sure all the lower level handling can be done semi-asynchronously and still we can reply in a synchronous way. The in-event is passed to the requires port and we raise an async request. If the async ackowledges we know all the processing in the context of the original in-event has completed and hence the required synchronous out-event is missing; we log the error, and create such an out-event in the armour. If the requires port receives an out-event this is happening in the context of the the original in-event (since the async acknowledge did not fire yet). Hence this is a synchronous reply and everything is fine. We cancel the async to avoid the error trigger.

component ArmourMSOE {
    provides IStrict pStrict;
    requires IRobust rRobust;
    requires injected ILogger iLog;

    behaviour {
        requires dzn.async p;
        bool xxxx = false;

        on pStrict.ia(): blocking {rRobust.ia(); p.req();}
        on rRobust.oa(): {pStrict.reply(); pStrict.oa(); p.clr();}
        on p.ack(): {pStrict.reply(); pStrict.oa(); iLog.Log($"Foreign comp does not send sync out-event oa"$);}
    }
}

The full armour example code including the client and overall system component is here:

Basic example: ArmourMSOE
Example with error handling: ArmourMSOEError


Next: , Previous: , Up: Individual Armour cases   [Contents]