Analytic Block Parallel Input Out of Synch Issue

Apama Analytics Builder used and Version: level:

Detailed explanation of the problem: Getting synchronization issue for blocks having Multiple input ports. For example, For a output block of type Measurement Output, we want to sent a measurement with as Fragment along with some custom Fragment as coming in properties port, and the properties port receives the input bit delayed, then the result is not as expected. Input in the properties port are inserted into wrong measurement output.

What could be possible issue and its resolution ?
Please guide.

Error messages / full error message screenshot / log file:

Measurement Data:

Question related to a Partner Tenant, or to a Partner instance?


if the delay is fixed, the most obvious solution would be to use the Delay block similar to how you use it to simulate the problem. Most likely that is not the case I guess.

I assume what you want to achieve is to always match the measurement value with the corresponding property and not miss any of either of them?

Then that is not easily doable with the built-in blocks as it would require queuing functionality. If you know that you would only ever have to queue one value of each, you could probably do that queuing using a clever usage of the AND block.

Otherwise you would require a custom block that queues in its local state and outputs synchronized values whenever each queue contains at least one value. If custom block development is an option for you, I could share a high level sketch of how this would look like.

Best regards,

1 Like

Thank you for your prompt reply.
Yes, You said it right, Delay is used to simulate the issue.

Yes, we want to achieve is to always match the measurement value with the corresponding property and not miss any of either of them.

Actual Issue is to something similar below:

MO- Managed Object.
Query MO, API Call, Update MO are custom block.

Please share a sketch to achieve it, would be very helpful.


Hi Matiur,

I have not tested this, but it should work like this below. Note, that the two inputs are pulse inputs and you should put a “Set Property” block before the input and put the value into a property called “value”. The reason for this is that only with a pulse will you be able to detect which input triggered the invocation of the “$process” action. We need this to associate the correct input values. If an input triggered “$process” we store the value in a buffer. If we have received values on both inputs, we take the oldest values for each and produce an output.

Note: instead of doing this in a separate block you could incorporate this logic into your “Make API Call” block if it makes sense.

event SyncInputs_$State {
    sequence<float> buffer1;
    sequence<float> buffer2;

event SyncInputs {
	action $process(Activation $activation, Value $input_value1, Value $input_value2, SyncInputs_$State $blockState) {
        boolean v1active := <boolean> $input_value1.value;
        boolean v2active := <boolean> $input_value2.value;

        if(v1active) {
        if(v2active) {

        if($blockState.buffer1.size()>0 and $blockState.buffer1.size()>0) {
            $setOutput_output1($activation, $blockState.buffer1[0]);
            $setOutput_output2($activation, $blockState.buffer2[0]);

    constant string $INPUT_TYPE_value1 := "pulse";
    constant string $INPUT_TYPE_value2 := "pulse";

	action<Activation,float> $setOutput_output1;	
    action<Activation,float> $setOutput_output2;

1 Like

Thank You @Harald_Meyer ,
Will try this.
The blocks are separated to make it generic and reusable.

Tried as said, however not able to succeed yet. For single source it works, for input from group of device, it is yet to work.
Any way we can handle inputs from group of device?

One major issue is, $process 's $input_… is holding previous values if pulse is not received. So, I tried to take care this using Value.timestamp value somehow for single input source, not able to get expected result where input is from a Device Group.

SyncInputs.txt (4.7 KB)

Maintaining source Id wise buffer may work, not sure, but is becoming more & more tricky,
What could be best viable solution?
Please suggest.

1 Like

Hi Matiur,

One major issue is, $process 's $input_… is holding previous values if pulse is not received.

My assumption was that you could use the $input_.value field to check if it is true or not and it would only be true if the pulse was received. Is that not the case?

not able to get expected result where input is from a Device Group.

In case of device groups, the state should be split by individual device. So it is strange that this is not working for you. This is the explanation:

Let me also try to reproduce the issue.

Best regards,

It is measurement input and holding float value, and for next iterations when value1 has a new value valu2 and value3 holds old value. That is what is being printed in log.
For next iterations when value1 receiving pulse, other should be empty or reset, but it holds previous values. So, I am comparing the input’s timestamp and ignoring the same if found equal.

Let me deep dive for group of device issue. Will update.

Interestingly, your block seems to work for me. I created a model similar to yours (also with delays) for a group of devices. I sent in a value of “200” for device 1 and then a value of “104” for device 2 before the delay occurred.

Input 1:


Input 2:


Output 1:


Output 2:

1 Like

I am checking more, may be I did some mistake analyzing the log.

Could you please check once for next iterations(not first one),
As my simulator sending values (0,10,20,30,40,50) in every 5 seconds. In the model, First delay is of 5 seconds and 2nd delay is of 7 seconds.

So, for me,
for first iteration its OK, but in next iterations some reading found to be missing
I am expecting a result 0,30,60,90,120,150

Anyway, It seems will work, testing for it to be foolproof.

Thank you for you time.

@Harald_Meyer ,
Seems Its working.