question

Upvotes
Accepted
40 2 1 7

How to read the MaxMessagesPerSecond element from an RCC RefreshMsg?

I have an EMA application that posts data to the RCC. As part of the connection sequence (register/tunnel/login) it receives a RefreshMsg like this:

RefreshMsg
    streamId="5"
    domain="System Domain"
    RefreshComplete
    PrivateStream
    DoNotCache
    state="Open / Ok / None / 'Login accepted by host 6805549f73b5 via ip-10-28-117-11.ec2.internal'"
    itemGroup="00 00"
    name="XXX"
    Attrib dataType="ElementList"
        ElementList
            ElementEntry name="TRCE:MaxMessagesPerSecond" dataType="UInt" value="10000"
        ElementListEnd
    AttribEnd
RefreshMsgEnd

I would like to read the MaxMessagesPerSecond value and use it for subsequent posting. I could parse it out of this text, but is there a way to way to access directly via the msg argument in code like that below:

(Note the pseudocode line that tries to set MsgLimit)

void AppClient::onRefreshMsg(const RefreshMsg& msg, const OmmConsumerEvent& event) {
   LOG_API.printf("%s\n%s\n", __FUNCTION__, msg.toString().c_str());
   if (msg.getDomainType() == MMT_SYSTEM
      && event.getHandle() == _subStreamHandle
      && msg.getState().getStreamState() == OmmState::OpenEnum
      && msg.getState().getDataState() == OmmState::OkEnum)
   {
      SetState(AS_loggedin);
      
      // Get the message limit if present.
      UINT MsgLimit = msg.SomeFunction().someOtherFunction().etc()
   }
}


ema-apircc
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
87.5k 294 53 79

@jeff.birkel

You can use the forth method to look for an element entry with the matching name, as shown below.

const ElementList& el = refreshMsg.getAttrib().getElementList();
        if (el.forth("TRCE:MaxMessagesPerSecond")) {
            cout << el.getEntry().getName() << ":" << el.getEntry().getUInt();
        }
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.