question

Upvotes
Accepted
20 7 8 11

ETA Publisher - optimizing for one-to-many event publish scenario - EncodeIterator/TransportBuffer/etc.

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.

elektronrefinitiv-realtimeelektron-sdkrrteta-apielektron-transport-apiencodingfanout
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
78.1k 246 52 72

@Paul.Wuethrich2

I think you can encode data to the Buffer and then copy it to the TransportBuffer.

Buffer buffer= CodecFactory.createBuffer();
buffer.data(ByteBuffer.allocate(500));

setBufferAndRWFVersion(Buffer buffer, int rwfMajorVersion, int rwfMinorVersion);

For example, you can encode the payload to the buffer and then reuse it when encoding the refresh or update message to the TransportBuffer.

As I know, you can't change the encoded value in the payload.

You can replace the following values in the encoded message with the EncodeIterator.

int    replaceDataState(int dataState)
Convenience method that replaces the data state on an encoded UPA message.
int    replaceGroupId(Buffer groupId)
Convenience method that replaces the group id on an encoded UPA message.
int    replacePostId(int postId)
Convenience method that replaces an encoded post messages postId.
int    replaceSeqNum(long seqNum)
Convenience method that replaces the seqNum on an encoded UPA message.
int    replaceStateCode(int stateCode)
Convenience method that replaces the state code on an encoded UPA message.
int    replaceStreamId(int streamId)
Convenience method that replaces the streamId on an encoded UPA message.
int    replaceStreamState(int streamState)
Convenience method that replaces the stream state on an encoded UPA message.


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.