question

Upvotes
Accepted
21 0 0 3

How to know the RIC for each Update?

Hi, Dear all:

Here, I need to know the RIC for each update message.

I had referred to asked questions. For Java edition, it was suggested to add respMsg.getAttribInfo().getName().

I tried the following code in the RFA C++ StarterConsumer example,

void StarterConsumer::processMarketPriceResponse(const rfa::sessionLayer ...)

{

string temp_str;

....

temp_str = TRRic.assign(respMsg.getAttribInfo().getName().c_str());

....

}

But I found for the first time to subscribe data, the RIC can be fetched by temp_str, but for the coming update from second time, the temp_str is always null string.

Do you know what's the reason?

Best Regards

Zheng

treprfarfa-apirics
icon clock
10 |1500

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

Upvotes
Accepted
7.6k 15 6 9

@Zheng.Huang

By default, you will get RIC name in the Refresh message only.

If you want to get RIC name in both Refresh and Update message type, you have to add below flag to item request message.

| ReqMsg::AttribInfoInUpdatesFlag<br>
icon clock
10 |1500

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

Upvotes
21 0 0 3

@moragodkrit

Thanks for your tips.

Then, may I know more detail? How to set the interaction type of the item request message as "| ReqMsg::AttribInfoInUpdatesFlag"

icon clock
10 |1500

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

Upvotes
21 0 0 3

There's one line code:

reqMsg.setIndicationMask(reqMsg.getIndicationMask() | rfa::message::ReqMsg::ViewFlag);

Do you mean, it should be:

reqMsg.setIndicationMask(reqMsg.getIndicationMask() | rfa::message::ReqMsg::AttribInfoInUpdatesFlag);

icon clock
10 |1500

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

Upvotes
21 0 0 3

I tried the code:

reqMsg.setIndicationMask(reqMsg.getIndicationMask() | rfa::message::ReqMsg::AttribInfoInUpdatesFlag);

but it can't work.

icon clock
10 |1500

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

Upvotes
7.6k 15 6 9

@Zheng.Huang

Are you using StarterConsumer_BatchView?


Actually, the example already received AttribInfo in the update message. But the reason that you did not see item name in the update message because the example was designed to look up item name in item map by using the handle returned from the event instead.
There are the codes that check and print item name and service name when response type Refresh and Status only.

Please review the example codes under a method named StarterConsumer_BatchView::processMarketPriceResponse.

if ((respMsg.RespType == RespMsg.RespTypeEnum.Refresh || respMsg.RespType == RespMsg.RespTypeEnum.Status) && ((respMsg.HintMask & RespMsg.HintMaskFlag.AttribInfo) != 0) 
{ 
.... Print AttribInfo 
}else 
{ 
// Update message
} 

You may need to modify the codes in the method to print information from AttribInfo when receiving update message.

icon clock
10 |1500

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

Upvotes
21 0 0 3

Yes, because of additional requirements, I referred to some code in Batch example.

Thanks for your advice, let me try and feedback to you, thanks!

icon clock
10 |1500

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

Upvotes
21 0 0 3

@moragodkrit

Hi, Moragodkrit:

I read the code in StarterConsumer_BatchView example, and as you mentioned the "ReqMsg::AttribInfoInUpdatesFlag" should be set to make sure the RIC Name can be accessed.

If the AttribInfoInUpdatesFlag didn't set, I can do anything in the "else" part, right?

Then, it comes to the beginning, how to set it?

The ReqMsg.h has an enum IndicationMask and list parameters, such as:

enum IndicationMask { AttribInfoInUpdatesFlag = 0x1, FilteredInUpdatesFlag = 0x2, ViewFlag = 0x4, BatchFlag = 0x8 };

For example, the sendItemRequest method set the parameter as:
rfa::common::Handle* sendItemRequest(const rfa::common::RFA_String& itemName, const rfa::common::RFA_String& serviceName, rfa::common::UInt8 indicationMask = 0, rfa::common::UInt8 msgModelType = rfa::rdm::MMT_MARKET_PRICE, rfa::common::Int32 interType = rfa::message::ReqMsg::InitialImageFlag | rfa::message::ReqMsg::InterestAfterRefreshFlag);

Do you think the parameter of indicationMask should be changed?

Regards

icon clock
10 |1500

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

Upvotes
7.6k 15 6 9

@Zheng.Huang

I don't understand what is the problem now?

I understand that you already modified the indication mask in reqMsg to add AttribInfoInUpdatesFlag like below codes.

reqMsg.setIndicationMask(reqMsg.getIndicationMask() | rfa::message::ReqMsg::ViewFlag | rfa::message::ReqMsg::AttribInfoInUpdatesFlag);

I recommend you to read our RFA tutorial before copying the codes in our example to use in your app so that you can understand basic usage and how to process the event in RFA. You can find more details about the API usage and its flag from RFA C++ Developer Guide and RDMUsageGuide.pdf.

icon clock
10 |1500

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

Upvotes
21 0 0 3

@moragodkrit

My problem was how to get the RIC name for any status(Status, Refresh, Update). Because I need to pass related data to Tickerplant and let it know who's the owner of data.

With you help, I think the problem had been resolved. The key is set the "AttribInfoInUpdatesFlag" open as you mentioned. And then, in the processMarketPriceResponse method do a judgement:

if (ReqMsg::AttribInfoInUpdatesFlag)

{ const AttribInfo& atrInfo = respMsg.getAttribInfo();

temp_str = TRRic.assign(atrInfo.getName().c_str());

...

}

Thanks

Zheng

icon clock
10 |1500

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

Click below to post an Idea Post Idea