I am trying to read data for an instrument using RTSDK/C++. I have copied the sample code from Examples/Training/Consumer/400_Series/450_MP_QueryServiceDiscovery/Consumer.cpp and added a handle variable:
// Query endpoints from RDP service discovery for the TCP protocol
ServiceEndpointDiscovery serviceDiscovery(tokenUrl, serviceDiscoveryUrl);
serviceDiscovery.registerClient( ServiceEndpointDiscoveryOption().username( userName ).password( password )
.clientId( clientId ).transport( transportProtocol ).takeExclusiveSignOnControl( takeExclusiveSignOnControl )
.proxyHostName( proxyHostName ).proxyPort( proxyPort ).proxyUserName( proxyUserName ).proxyPassword( proxyPasswd )
.proxyDomain( proxyDomain ), client );
createProgramaticConfig( configDb );
OmmConsumer consumer( config.consumerName( "Consumer_1" ).username( userName ).password( password )
.clientId( clientId ).config( configDb ).takeExclusiveSignOnControl( takeExclusiveSignOnControl )
.tunnelingProxyHostName( proxyHostName ).tunnelingProxyPort( proxyPort )
.proxyUserName( proxyUserName ).proxyPasswd( proxyPasswd ).proxyDomain( proxyDomain ) );
Int64 closure = 1;
UInt64 itemHandle = consumer.registerClient(ReqMsg().serviceName("ELEKTRON_DD").name("IBM.N"), client, (void*)closure);
consumer.reissue(ReqMsg().serviceName("ELEKTRON_DD").name("IBM.N").priority(2, 2), itemHandle);
sleep(60000);
consumer.submit(PostMsg().payload(FieldList().addInt(1, 100).complete()), itemHandle);
sleep( 900000 ); // API calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg()
I get a handle, but the submit() throws an exception:
Attempt to use invalid Handle on submit( const PostMsg& ). Instance name='Consumer_1_1'.
None of the trigger functions, like OnReqMsg() are called
How do I consume data for an instrument?
Should I have a loop, waiting on messages?