Hi All,
I'm having troubles in decoding the MapEntry. After logging in and successfully subscribing for multiple pairs I start receiving MMT_MARKET_BY_PRICE, so I get the payload and I iterate over the Map.
Here comes the problem! When I try to get the MapEntry Key the DataBuffer seems to be always blank.
Could you please which might be the issue? I attach here the code so that you can also take a look at the method calls that I'm using.
Thanks
// extracted just a piece of function needed for the troubleshotting
if(respMsg.getHintMask() & rfa::message::RespMsg::PayloadFlag) {
const rfa::common::Data& data = respMsg.getPayload();
if (data.isBlank()) {
return;
}
if(data.getDataType() == rfa::data::MapEnum) {
decodeMap(DateTime::now(),iInstrument.value(),static_cast<const rfa::data::Map&>(data));
} else{
LOG(ERROR) << "Cannot decode market data. Expexting a MapEntry to start decoding process";
}
}
decodeMap(const UtcNanos now, const std::size_t iInstrument, const rfa::data::Map& input) {
rfa::data::MapReadIterator it;
while(!it.off()){
modelUpdated |= decodeMapEntry(now,quoteModel,instrumentData,it.value());
it.forth();
}
}
decodeMapEntry(const UtcNanos now,
ew::lp::QuoteModel& quoteModel,
const InstrumentData& instrumentData,
const rfa::data::MapEntry& input) {
const rfa::data::DataBuffer& buffer = static_cast<const rfa::data::DataBuffer&>(input.getKeyData());
if(buffer.isBlank()){
return false;
}
const std::string quoteID = buffer.getAsString().c_str();
switch(input.getAction()){
case rfa::data::MapEntry::Action::Update:
return updateQuote(now,"",quoteModel,instrumentData,static_cast<const rfa::data::FieldList&>(input.getData()));
case rfa::data::MapEntry::Action::Add:
return addQuote(now,"",quoteModel,instrumentData,static_cast<const rfa::data::FieldList&>(input.getData()));
case rfa::data::MapEntry::Action::Delete:
return deleteQuote("",quoteModel);
default:
LOG(ERROR) << "Unhandled MapEntry Action";
}