We have a Java ETA Publisher application that pushes MarketPriceUpdates/Refreshes to subscribing clients and I'm unclear on how whether we can minimize calls to EncodeIterator when publishing a single event update for a RIC to multiple clients.
High-level/Simplified Application flow is as follows:
EncodeIterator ei = CodecFactory.createEncodeIterator()
for(Channel c : clientSubscriberChannels) {
ei.clear()
TransportBuffer t =Channel.getBuffer(...)
ei.setBufferAndRWFVersion(t, ....)
Msg m = encodeMsg()
...
// FIeldList.encodeInit(ei, ...)
...
// FieldEntry.encode(ei, ...)
...
m.encodeComplete(ei, ...)
...
c.write(t, ...)
}
My assumption per the API docs is that we need to allocate a new TransportBuffer for each client that needs to receive the same event in a one-to-many scenario but can I optimize any of the above encoding requirements to minimize object creation?
1) Re-use the Msg object?
2) Avoid having to clear the EncodeIterator and subsequently encoding the FieldList and FieldEntries?
3) If there is a single Field that has client/subscriber specific data, can we simply re-encode the one field or do we need to clear and re-encode all fields, etc.