void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent ) { cout << endl << "Received: " << "UpdateMsg" << endl << "Handle: " << ommEvent.getHandle() << " Closure: " << ommEvent.getClosure() << endl; if ( updateMsg.hasMsgKey() ) cout << "Item Name: " << updateMsg.getName() << endl << "Service Name: " << ( updateMsg.hasServiceName() ? updateMsg.getServiceName() : EmaString( "not set" ) ) << endl; decode( updateMsg ); }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent ) { cout << endl << "Handle: " << ommEvent.getHandle() << " Closure: " << ommEvent.getClosure() << endl; cout << endl << "Item Name: " << ( updateMsg.hasName() ? updateMsg.getName() : EmaString( "<not set>" ) ) << endl << "Service Name: " << (updateMsg.hasServiceName() ? updateMsg.getServiceName() : EmaString( "<not set>" ) ) << endl; decode( updateMsg ); }
int main( int argc, char* argv[] ) { try { Map configMap; createProgrammaticConfig( configMap ); OmmProvider provider( OmmNiProviderConfig().config( configMap ).username( "user" ) ); UInt64 ibmHandle = 5; UInt64 triHandle = 6; RefreshMsg refresh; UpdateMsg update; FieldList fieldList; provider.submit( refresh.serviceName( "NI_PUB" ).name( "IBM.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList .addReal( 22, 14400, OmmReal::ExponentNeg2Enum ) .addReal( 25, 14700, OmmReal::ExponentNeg2Enum ) .addReal( 30, 9, OmmReal::Exponent0Enum ) .addReal( 31, 19, OmmReal::Exponent0Enum ) .complete() ) .complete(), ibmHandle ); provider.submit( refresh.clear().serviceName( "NI_PUB" ).name( "TRI.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList.clear() .addReal( 22, 4100, OmmReal::ExponentNeg2Enum ) .addReal( 25, 4200, OmmReal::ExponentNeg2Enum ) .addReal( 30, 20, OmmReal::Exponent0Enum ) .addReal( 31, 40, OmmReal::Exponent0Enum ) .complete() ) .complete(), triHandle ); sleep( 1000 ); for ( Int32 i = 0; i < 60; i++ ) { provider.submit( update.clear().serviceName( "NI_PUB" ).name( "IBM.N" ) .payload( fieldList.clear() .addReal( 22, 14400 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 10 + i, OmmReal::Exponent0Enum ) .complete() ), ibmHandle ); provider.submit( update.clear().serviceName( "NI_PUB" ).name( "TRI.N" ) .payload( fieldList.clear() .addReal( 22, 4100 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 21 + i, OmmReal::Exponent0Enum ) .complete() ), triHandle ); sleep( 1000 ); } } catch ( const OmmException& excp ) { cout << excp << endl; } return 0; }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent ) { cout << endl << "Received Update. Item Handle: " << ommEvent.getHandle() << " Closure: " << ommEvent.getClosure() << endl; if ( updateMsg.hasMsgKey() ) cout << endl << "Item Name: " << updateMsg.getName() << endl << "Service Name: " << updateMsg.getServiceName() << endl; if ( DataType::FieldListEnum == updateMsg.getPayload().getDataType() ) decode( updateMsg.getPayload().getFieldList() ); }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent ) { if ( updateMsg.hasMsgKey() ) cout << endl << "Item Name: " << updateMsg.getName() << endl << "Service Name: " << updateMsg.getServiceName() << endl; if ( DataType::FieldListEnum == updateMsg.getPayload().getDataType() ) decode( updateMsg.getPayload().getFieldList() ); // Close streaming request after receiving 3 update messages if ( ++numOfUpdates == 3 ) { cout << endl << "Close Item request" << endl; _pOmmConsumer->unregister( ommEvent.getHandle() ); } }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ) { ++updateCount; const Payload& payload = updateMsg.getPayload(); if ( payload.getDataType() == DataType::FieldListEnum ) decode( payload.getFieldList() ); }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ) { cout << endl << "Item Name: " << ( updateMsg.hasName() ? updateMsg.getName() : EmaString( "<not set>" ) ) << endl << "Service Name: " << (updateMsg.hasServiceName() ? updateMsg.getServiceName() : EmaString( "<not set>" ) ); if ( DataType::MapEnum == updateMsg.getPayload().getDataType() ) decode( updateMsg.getPayload().getMap() ); }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ommEvent ) { cout << endl << "Item Name: " << ( updateMsg.hasName() ? updateMsg.getName() : EmaString( "<not set>" ) ) << endl << "Service Name: " << (updateMsg.hasServiceName() ? updateMsg.getServiceName() : EmaString( "<not set>" ) ); cout << endl << "Item Handle: " << ommEvent.getHandle() << endl << "Item Closure: " << ommEvent.getClosure() << endl; if ( DataType::FieldListEnum == updateMsg.getPayload().getDataType() ) decode( updateMsg.getPayload().getFieldList() ); }
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& ) { if ( updateMsg.hasName() ) cout << endl << "Item Name: " << updateMsg.getName(); if ( updateMsg.hasServiceName() ) cout << endl << "Service Name: " << updateMsg.getServiceName(); cout << endl; if ( DataType::FieldListEnum == updateMsg.getPayload().getDataType() ) decode( updateMsg.getPayload().getFieldList() ); }
int main( int argc, char* argv[] ) { try { int iargs = 1; while ( iargs < argc ) { if ( ( strcmp("-dumpDictionary", argv[iargs] ) == 0) ) { dumpDictionary = true; } //APIQA else if ((strcmp("-filter", argv[iargs]) == 0)) { if (++iargs == argc) break; EmaString value(argv[iargs]); if (value.caseInsensitiveCompare("INFO")) { filter = DICTIONARY_INFO; } else if (value.caseInsensitiveCompare("MINIMAL")) { filter = DICTIONARY_MINIMAL; } else if (value.caseInsensitiveCompare("NORMAL")) { filter = DICTIONARY_NORMAL; } else if (value.caseInsensitiveCompare("VERBOSE")) { filter = DICTIONARY_VERBOSE; } } //END APIQA ++iargs; } OmmProvider provider( OmmNiProviderConfig().username( "user" ) ); UInt64 triHandle = 5; UpdateMsg update; FieldList fieldList; AppClient client; // Open Dictionary streams UInt64 fldHandle = provider.registerClient(ReqMsg().name("RWFFld").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY), client); UInt64 enumHandle = provider.registerClient(ReqMsg().name("RWFEnum").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY), client); provider.submit( RefreshMsg().serviceName( "NI_PUB" ).name( "TRI.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList.clear() .addReal( 22, 4100, OmmReal::ExponentNeg2Enum ) .addReal( 25, 4200, OmmReal::ExponentNeg2Enum ) .addReal( 30, 20, OmmReal::Exponent0Enum ) .addReal( 31, 40, OmmReal::Exponent0Enum ) .complete() ) .complete(), triHandle ); sleep( 1000 ); for ( Int32 i = 0; i < 10; i++ ) { provider.submit( update.clear().serviceName( "NI_PUB" ).name( "TRI.N" ) .payload( fieldList.clear() .addReal( 22, 4100 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 21 + i, OmmReal::Exponent0Enum ) .complete() ), triHandle ); sleep( 1000 ); //APIQA if ( i == 6 ) { cout <<"Reissue Dictionary handles with filter unchange " << endl; provider.reissue( ReqMsg().name("RWFFld").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY).interestAfterRefresh(true), fldHandle); provider.reissue( ReqMsg().name("RWFEnum").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY).interestAfterRefresh(true), enumHandle); } if ( i == 8 ) { cout <<"Reissue Dictionary handles with filter unchange " << endl; filter = DICTIONARY_NORMAL; provider.reissue( ReqMsg().name("RWFFld").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY).interestAfterRefresh(true), fldHandle); provider.reissue( ReqMsg().name("RWFEnum").filter(filter).serviceName("NI_PUB").domainType(MMT_DICTIONARY).interestAfterRefresh(true), enumHandle); } if ( i == 9 ) { cout <<"Update Source Directory with delete service from DIRECTORY " << endl; provider.submit(UpdateMsg().domainType(MMT_DIRECTORY) .payload(Map() .addKeyUInt(1, MapEntry::DeleteEnum, FilterList() .complete()).complete()), 0); } } sleep( 1000 ); //END APIQA } catch ( const OmmException& excp ) { cout << excp << endl; } return 0; }
int main() { try { OmmProvider provider( OmmNiProviderConfig().adminControlDirectory( OmmNiProviderConfig::UserControlEnum ).username( "user" ) ); UInt64 serviceId = 0; UInt64 sourceDirectoryHandle = 1; UInt64 ibmHandle = 5; RefreshMsg refresh; UpdateMsg update; FieldList fieldList; provider.submit( refresh.domainType( MMT_DIRECTORY ).filter( SERVICE_INFO_FILTER | SERVICE_STATE_FILTER ) .payload( Map() .addKeyUInt( serviceId, MapEntry::AddEnum, FilterList() .add( SERVICE_INFO_ID, FilterEntry::SetEnum, ElementList() .addAscii( ENAME_NAME, "TEST_NI_PUB" ) .addArray( ENAME_CAPABILITIES, OmmArray() .addUInt( MMT_MARKET_PRICE ) .addUInt( MMT_MARKET_BY_PRICE ) .complete( ) ) .addArray( ENAME_DICTIONARYS_USED, OmmArray() .addAscii( "RWFFld" ) .addAscii( "RWFEnum" ) .complete( ) ) .complete() ) .add( SERVICE_STATE_ID, FilterEntry::SetEnum, ElementList() .addUInt( ENAME_SVC_STATE, SERVICE_UP ) .complete() ) .complete() ) .complete() ).complete(), sourceDirectoryHandle ); provider.submit( refresh.clear().serviceName( "TEST_NI_PUB" ).name( "IBM.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList .addReal( 22, 14400, OmmReal::ExponentNeg2Enum ) .addReal( 25, 14700, OmmReal::ExponentNeg2Enum ) .addReal( 30, 9, OmmReal::Exponent0Enum ) .addReal( 31, 19, OmmReal::Exponent0Enum ) .complete() ) .complete(), ibmHandle ); sleep( 1000 ); for ( Int32 i = 0; i < 60; i++ ) { provider.submit( update.clear().serviceName( "TEST_NI_PUB" ).name( "IBM.N" ) .payload( fieldList.clear() .addReal( 22, 14400 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 10 + i, OmmReal::Exponent0Enum ) .complete() ), ibmHandle ); sleep( 1000 ); } } catch ( const OmmException& excp ) { cout << excp << endl; } return 0; }
int main( int argc, char* argv[] ) { try { OmmNiProviderConfig config; int securityProtocol = 0; for (int i = 0; i < argc; i++) { if (strcmp(argv[i], "-?") == 0) { printHelp(); return false; } else if (strcmp(argv[i], "-ph") == 0) { config.tunnelingProxyHostName(i < (argc - 1) ? argv[++i] : NULL); } else if (strcmp(argv[i], "-pp") == 0) { config.tunnelingProxyPort(i < (argc - 1) ? argv[++i] : NULL); } else if (strcmp(argv[i], "-spTLSv1") == 0) { securityProtocol |= OmmNiProviderConfig::ENC_TLSV1; } else if (strcmp(argv[i], "-spTLSv1.1") == 0) { securityProtocol |= OmmNiProviderConfig::ENC_TLSV1_1; } else if (strcmp(argv[i], "-spTLSv1.2") == 0) { securityProtocol |= OmmNiProviderConfig::ENC_TLSV1_2; } else if (strcmp(argv[i], "-libsslName") == 0) { config.tunnelingLibSslName(i < (argc - 1) ? argv[++i] : NULL); } else if (strcmp(argv[i], "-libcryptoName") == 0) { config.tunnelingLibCryptoName(i < (argc - 1) ? argv[++i] : NULL); } } if (securityProtocol > 0) config.tunnelingSecurityProtocol(securityProtocol); //API QA Map configMap; createProgrammaticConfig(configMap); OmmProvider provider( config.config(configMap).username( "user" ).providerName( "Provider_4" ) ); //END API QA UInt64 ibmHandle = 5; UInt64 triHandle = 6; RefreshMsg refresh; UpdateMsg update; FieldList fieldList; provider.submit( refresh.serviceName( "TEST_NI_PUB" ).name( "IBM.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList .addReal( 22, 14400, OmmReal::ExponentNeg2Enum ) .addReal( 25, 14700, OmmReal::ExponentNeg2Enum ) .addReal( 30, 9, OmmReal::Exponent0Enum ) .addReal( 31, 19, OmmReal::Exponent0Enum ) .complete() ) .complete(), ibmHandle ); provider.submit( refresh.clear().serviceName( "TEST_NI_PUB" ).name( "TRI.N" ) .state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" ) .payload( fieldList.clear() .addReal( 22, 4100, OmmReal::ExponentNeg2Enum ) .addReal( 25, 4200, OmmReal::ExponentNeg2Enum ) .addReal( 30, 20, OmmReal::Exponent0Enum ) .addReal( 31, 40, OmmReal::Exponent0Enum ) .complete() ) .complete(), triHandle ); sleep( 1000 ); for ( Int32 i = 0; i < 60; i++ ) { provider.submit( update.clear().serviceName( "TEST_NI_PUB" ).name( "IBM.N" ) .payload( fieldList.clear() .addReal( 22, 14400 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 10 + i, OmmReal::Exponent0Enum ) .complete() ), ibmHandle ); provider.submit( update.clear().serviceName( "TEST_NI_PUB" ).name( "TRI.N" ) .payload( fieldList.clear() .addReal( 22, 4100 + i, OmmReal::ExponentNeg2Enum ) .addReal( 30, 21 + i, OmmReal::Exponent0Enum ) .complete() ), triHandle ); sleep( 1000 ); } } catch ( const OmmException& excp ) { cout << excp << endl; } return 0; }