Hello,
I have a strange problem when I contribute data to RICs on ATS using EMA API. Sometimes data on 1 (or even more) RICs are incorrect/mixed - diffrent from values I sent to ATS via PostMsg. I noticed the problem occurs only during 2-nd, or more contribution to there RICs - during first contribution I haven't seen this error yet.
I open a stream (LOGIN) only once when service starting and send all PostMsgs to that stream one by one. Is it possible it is the problem and in some cases value are mixed on stream? In addition I have only one instance of OMMConsumer for LOGIN stream to contribute data and other streams to collect data from RICs.
Below I attach a part of my source code, and log describing the problem.
Code:
var postMsg = new PostMsg();
var nestedRefreshMsg = new UpdateMsg();
int serviceId = _marketDataSettings.ServiceId;
int peOperator = AuthorizationLock.OperatorEnum.AND;
var peList = new List<uint> { _marketDataSettings.PPE };
var authLock = new AuthorizationLock(serviceId, peOperator, peList);
var lockData = new AuthorizationLockData();
var lockStatus = new AuthorizationLockStatus();
var lockResult = authLock.GetLock(lockData, lockStatus);
if (lockResult != AuthorizationLockData.LockResultEnum.LOCK_SUCCESS)
{
authLock.Dispose();
}
var permissionBuffer = new EmaBuffer(lockData.LockData, 0, lockData.Size);
var nestedFieldList = new FieldList();
foreach (var field in fields)
{
if (field.Value is decimal)
{
decimal? val = field.Value as decimal?;
if (val.HasValue)
{
_logger.LogInformation($"Contributing value {val} to RIC {ric}");
nestedFieldList.AddReal(field.Key, (long)(val.Value * 100), MagnitudeTypes.EXPONENT_NEG_2);
}
}
}
nestedFieldList.Complete();
nestedRefreshMsg.Payload(nestedFieldList);
postMsg.PermissionData(permissionBuffer);
postMsg.PostId(_postId++)
.ServiceName(serviceName)
.Name(ric)
.SolicitAck(true)
.Complete(true)
.Payload(nestedRefreshMsg)
_consumer.Submit(postMsg, _handleSendId.Value)
Log:
2024-03-20 17:05:37.0722|INFO|Contributing value 5.62000 to RIC GTRWIPLNSW=
2024-03-20 17:05:37.2097|INFO|AckMsg
streamId="1"
domain="MarketPrice Domain"
ackId="19"
text="[2]: Contribution Partially Accepted"
name="GTRWIPLNSW="
nameType="1"
serviceId="258"
Payload dataType="NoData"
NoData
NoDataEnd
PayloadEnd
AckMsgEnd
2024-03-20 17:05:37.2097|INFO|PowerRates.MarketData.MarketData.MarketDataHandler|UpdateMsg
streamId="15"
domain="MarketPrice Domain"
updateTypeNum="0"
name="GTRWIPLNSW="
serviceId="258"
serviceName="DTS"
Payload dataType="FieldList"
FieldList
FieldEntry fid="16" name="TRADE_DATE" dataType="Date" value="20 MAR 2024 "
FieldEntry fid="5" name="TIMACT" dataType="Time" value="16:05:37:115:000:000"
FieldEntry fid="393" name="PRIMACT_1" dataType="Real" value="5.65"
FieldEntry fid="875" name="VALUE_DT1" dataType="Date" value="20 MAR 2024 "
FieldEntry fid="1010" name="VALUE_TS1" dataType="Time" value="16:05:37:115:000:000"
FieldEntry fid="2672" name="A_LEVEL_1" dataType="UInt" value="(blank data)"
FieldEntry fid="2673" name="A_LEVEL_2" dataType="UInt" value="(blank data)"
FieldListEnd
PayloadEnd
UpdateMsgEnd
As you can see above, I sent value 5.62 to field PRIMACT_1, received ACK and then received UpdateMsg with value 5.65. I sent values to 8 RICs one by one in 1 second deay between each contribution.
Do you have any idea, what is the problem? I would be grateful for your help.
Best regards.