question

Upvotes
Accepted
11 1 1 4

Item Resubscription

So we open a session for subscription for an item say AAPL.OQ, get some refresh and updates, then close the subscription using CloseMsg with below params:

closeMsg.clear();
encodeIterator.clear();
closeMsg.msgClass(MsgClasses.CLOSE);
closeMsg.containerType(DataTypes.NO_DATA);
closeMsg.flags(CloseMsgFlags.ACK);
byteBuffer.clear();
encodeBuffer.clear();
encodeBuffer.data(byteBuffer);

encodeIterator.setBufferAndRWFVersion(encodeBuffer, Codec.majorVersion(), Codec.minorVersion());

Now within the same session, I want to resubscribe to AAPL.OQ, I see that though my request for subscription is sent to TREP, I don't get any responses (refresh messages) back.

How to resubscribe after unsubscription within the same session

elektronrefinitiv-realtimeelektron-sdktrep
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
38.1k 69 35 53

@pratik.p.mehta

To close a stream, you need to specify the streamID of the closed item.

closeMsg.clear();
closeMsg.msgClass(MsgClasses.CLOSE);
closeMsg.streamId(streamId());
closeMsg.domainType(domainType);
closeMsg.containerType(DataTypes.NO_DATA);

After that, you can send a new request message to subscribe to that item.

You can refer to the com.thomsonreuters.upa.examples.consumer example in the Elektron SDK package regarding closing and requesting items.

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
20.3k 73 10 20

Hi @pratik.p.mehta

Depending on your use case / requirements - you may want to explore the Pause / Resume functionality available with the Elektron APIs.

As the name suggests, you can pause an event stream and resume it as required - for some scenarios this can be more efficient than close and resubscribe.

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