btc-ag / service-idl

Xtext-based Service IDL (Interface Definition Language) and Code Generators for Protobuf, C++, Java and .NET
Eclipse Public License 2.0
8 stars 8 forks source link

Enable setting timeout in generated proxy constructor #247

Closed remundst-berlin closed 5 years ago

remundst-berlin commented 5 years ago

request for ServiceComm 0.10 Generated proxies set the communication timeout to 2 sec while beeing constructed. Please generate a further parameter for the constructor of the generated proxy for communication timeout. This timeout parameter should be used in the constructor call of the proxy base class, where up to now a default timeout of 2 sec is used.

old example:

   CCyclicCalculationProxy::CCyclicCalculationProxy
   ( BTC::Commons::Core::Context &context,BTC::Logging::API::LoggerFactory &loggerFactory
   ,BTC::ServiceComm::API::IClientEndpoint &localEndpoint  ,BTC::Commons::CoreExtras::Optional<BTC::Commons::CoreExtras::UUID> const &serverServiceInstanceGuid
   ) :
   m_context(context), BTC_CAB_LOGGING_API_INIT_LOGGERAWARE(loggerFactory)
   , CyclicCalculationBase (context, localEndpoint, BTC::PRINS::PipelineCalc::PipelineCalcServices::ServiceAPI::ICyclicCalculation::TYPE_GUID(), 
                            serverServiceInstanceGuid/*, default parameter 2 sec is implicitly here*/ )

example for new proxy (additional lines are the ones with /----->>/ )

   CCyclicCalculationProxy::CCyclicCalculationProxy
   (BTC::Commons::Core::Context &context,BTC::Logging::API::LoggerFactory &loggerFactory
   ,BTC::ServiceComm::API::IClientEndpoint &localEndpoint
 /*----->>*/    ,BTC::Commons::Core::TimeSpan timeout
   ,BTC::Commons::CoreExtras::Optional<BTC::Commons::CoreExtras::UUID> const &serverServiceInstanceGuid
   ) :
   m_context(context), BTC_CAB_LOGGING_API_INIT_LOGGERAWARE(loggerFactory)
   , CyclicCalculationBase (context, localEndpoint, BTC::PRINS::PipelineCalc::PipelineCalcServices::ServiceAPI::ICyclicCalculation::TYPE_GUID(), 
                            serverServiceInstanceGuid,
 /*----->>*/                           timeout
                           )
sigiesec commented 5 years ago

Please test this with the generator version 1.1.0-sigiesec-implement-issue-247-SNAPSHOT

sigiesec commented 5 years ago

In the generator settings file, you need to add a line like

generatorOptions = cppProxyTimeoutSeconds=120

which would set the timeout to 120 seconds respectively 2 minutes