void onStatusMsg(const StatusMsg& statusMsg, const OmmConsumerEvent& event) |
{ |
if (event.getHandle() == _tunnelStreamHandle && |
statusMsg.hasState() && |
statusMsg.getState().getStreamState() == OmmState::OpenEnum ) |
{ |
// open substream with parent handle returned when opening tunnel stream below |
_pOmmConsumer->registerClient( ReqMsg().name( "TUNNEL_IBM" ).serviceId( 1 ), *this, |
(void*)1, _tunnelStreamHandle ); |
} |
} |
int main() |
{ |
try { |
AppClient client; |
OmmConsumer consumer( OmmConsumerConfig().username( "user" ) ); |
client.setOmmConsumer( consumer ); |
CosAuthentication cosAuthentication; |
cosAuthentication.type( CosAuthentication::OmmLoginEnum ); |
CosDataIntegrity cosDataIntegrity; |
cosDataIntegrity.type( CosDataIntegrity::ReliableEnum ); |
CosFlowControl cosFlowControl; |
cosFlowControl.type( CosFlowControl::BidirectionalEnum ).recvWindowSize( 1200 |
).sendWindowSize( 1200 ); |
ClassOfService cos; |
cos.authentication( cosAuthentication ).dataIntegrity( cosDataIntegrity |
).flowControl( cosFlowControl ); |
TunnelStreamRequest tsr; |
tsr.classOfService( cos ).domainType( MMT_SYSTEM ).name( "TUNNEL" ).serviceName( |
"DIRECT_FEED" ); |
/* open tunnel stream and save tunnel stream parent handle to be used for opening |
substreams in onStatusMsg() callback above */ |
_tunnelStreamHandle = consumer.registerClient( tsr, client ); |
sleep( 60000 ); // API calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg() |
} catch ( const OmmException& excp ) { |
cout << excp << endl; |
} |
} |