Hi all,
we have a smart serial element which takes http post requests from source and send responses. It works fine when handling individual requests but it seems to send incorrect responses when there are multiple requests coming in simultaneously. e.g. if there are request A, B and C and the correct responses are response A, B and C respectively, but instead the element sends response A, B, B for example.
We believe this is due to the shared parameter that saves each request body and it gets overridden quicker than the time it takes to send the response out hence some responses were sent to wrong requests.
So far we tried putting some delays within the code and also used 'makeCommandByProtocol' attribute but did not work. I am leaving my xml setting below. Could you please have a look and let me know if I'm doing anything wrong here or how to send correct responses out with simultaneous requests?
<Type relativeTimers="true" communicationOptions="makeCommandByProtocol">smart-serial</Type>
<Pairs>
<Pair id="1000">
<Name>Acknowledge HTTP 200 Success Message Pair</Name>
<Description>Acknowledge HTTP 200 Success Message Pair</Description>
<Content>
<Command>1000</Command>
</Content>
</Pair>
</Pairs>
<Commands>
<Command id="1000" ascii="true">
<Name>Acknowledge HTTP 200 Success Message Command</Name>
<Description>Acknowledge HTTP 200 Success Message Command</Description>
<Content>
<Param>1012</Param>
</Content>
</Command>
</Commands>
<Responses>
<Response id="1000">
<Name>Incoming HTTP Message</Name>
<Content>
<Param>1008</Param>
<Param>1009</Param>
<Param>1010</Param>
</Content>
</Response>
</Responses>
<Group id="1012">
<Name>Invoke Send Acknowledge HTTP 200 Success</Name>
<Type>poll</Type>
<Content>
<Pair>1000</Pair>
</Content>
</Group>
<Trigger id="1011">
<Name>Read Incoming HTTP Message</Name>
<On id="1000">response</On>
<Time>before</Time>
<Type>action</Type>
<Content>
<Id>1011</Id>
</Content>
</Trigger>
<Trigger id="1012">
<Name>Invoke Send Acknowledge HTTP 200 Success Trigger</Name>
<On id="1000">response</On>
<Time>after</Time>
<Type>action</Type>
<Content>
<Id>1012</Id>
</Content>
</Trigger>
<Trigger id="11">
<Name>Before Command</Name>
<On id="each">command</On>
<Time>before</Time>
<Type>action</Type>
<Content>
<Id>10</Id>
</Content>
</Trigger>
<Trigger id="12">
<Name>Before Response</Name>
<On id="each">response</On>
<Time>before</Time>
<Type>action</Type>
<Content>
<Id>12</Id>
</Content>
</Trigger>
<Action id="1011">
<Name>Read Incoming HTTP Message</Name>
<On>response</On>
<Type>read</Type>
</Action>
<Action id="1012">
<Name>Invoke Send Acknowledge HTTP 200 Success Action</Name>
<On id="1012">group</On>
<Type>execute</Type>
</Action>
<Action id="1021">
<Name>Backup Table</Name>
<On id="1021">parameter</On>
<Type>run actions</Type>
</Action>
<Action id="10">
<Name>Make Command Action</Name>
<On>command</On>
<Type>make</Type>
</Action>
<Action id="12">
<Name>Read Response Action</Name>
<On>response</On>
<Type>read</Type>
</Action>
Hello Paul,
You most likely need a buffer mechanism to hold your "flooded requests" and then treat them individually. Otherwise, you will try to get information that was already overwritten with new requests.