How do I get streamId after calling registerClient.
consumer.registerClient( ReqMsg().domainType( domain ).serviceName( subService ).name( subSymbol ), client );
I want to get the stream Id for the subSymbol. How do I get that?
Hello @vishal.anand ,
I suspect that you may be looking for a handle that is returned by registerConsumer call, that can be used to unregister the item, for example:
long handle = consumer.registerClient(reqMsg.serviceName("ELEKTRON_DD").name("IBM.N"), appClient); Thread.sleep(5000); consumer.unregister(handle);
If you are looking for the streamId it can be found in the received messages, in the attributes, for example:
UpdateMsg streamId="5" domain="MarketPrice Domain" updateTypeNum="1" name="IBM.N" serviceId="356" serviceName="ELEKTRON_DD" Payload dataType="FieldList" FieldList FieldEntry fid="22" name="BID" dataType="Real" value="130.510000" FieldEntry fid="25" name="ASK" dataType="Real" value="130.540000"
Hello @vishal.anand ,
You can:
From a refresh or an update, we can obtain both handle and streamID.
To obtain handle:
event.handle();
To obtain streamId we parse Attrib part of the message, see example 290 Custom_Decode for the code.
From that point on, you can create a map and store the relationship, and always map the handle and the streamId.
I am curious, what is your use case, why is it helpful to relate the two?
The use case is that we are writing a client to Feed Handler that will send request and check how many were received back and how many had errors. Basically some kind of monitoring app so the app needs to know specifically which requests were solicited.