Reason for restriction "output blocks not sending the same result in AnalyticsBuilder"

Hi,

what is the reason for the following restriction in AnalyticBuilder?

Note: For synchronous outputs, it is not allowed to have two or more output blocks which are generating the same output streams. From the above example, if there is another block with the same output stream already deployed in a model then deploying the model with the above block will result in a runtime error.

This is documented here.

Regards Christof

1 Like

Hi Christof,

The reason is to avoid indeterministic/ambiguous behavior at runtime when chains of model are involved. This can result in a diamond like topology.
If two output blocks are generating output stream of same type (for example Event of type ‘my_event’ for device ‘123’) and if an input block is consuming the input stream of the same type, it would get confused about which output to consume. This can result in indeterministic behavior if both output block produces output at the same time - in this case sometimes input block may consume output from one block and sometime in may consume output from other block. To avoid these kind of situation, we have a restriction that no two output blocks can produce output stream of same type.

This restriction is not applicable for sync type events (like Operations, or Managed Object updates) because they are no consumed immediately and does not have timing information to enforce ordering and consumed in async manner.

Similar restriction is there for wiring within the model - you can not connection two or more block output ports to a single input port of another block. In this case also there could be ambiguity about which value to pick from which wire.

Thanks,
Gyan