EMA C++ Developers Guide : 4 Consumer Classes : 4.1 OmmConsumer Class : 4.1.6 Example: Working with Items
 
4.1.6 Example: Working with Items
The following example illustrates using the item handle while modifying an item’s priority and posting modified content.
 
 
void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& event )
{
cout << “Received refresh message for item handle = “ << event.getHandle() << endl;
cout << refreshMsg << endl;
}
 
try {
AppClient client;
OmmConsumer consumer( OmmConsumerConfig().host( "localhost:14002" ).username( "user" ) );
 
Int64 closure = 1;
UInt64 itemHandle = consumer.registerClient( ReqMsg().serviceName( "DIRECT_FEED" ).name(
"IBM.N" ), client, (void*)closure );
 
consumer.reissue( ReqMsg().serviceName( "DIRECT_FEED" ).name( "IBM.N" ).priority( 2, 2 ),
itemHandle );
 
consumer.submit( PostMsg().payload( FieldList().addInt( 1, 100 ).complete() ), itemHandle
);
 
sleep( 60000 );
} catch ( const OmmException& excp ) {
cout << excp << endl;
}