/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/stream/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #pragma once #include "thrift/compiler/test/fixtures/stream/gen-cpp2/PubSubStreamingService.h" #include namespace cpp2 { typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::integral, ::std::int32_t*>> PubSubStreamingService_returnstream_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > PubSubStreamingService_returnstream_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_streamthrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_streamthrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_servicethrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult> > PubSubStreamingService_servicethrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_servicethrows2_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::cpp2::FooEx2>>, apache::thrift::ThriftPresult> > PubSubStreamingService_servicethrows2_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_boththrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_boththrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamstreamthrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_responseandstreamstreamthrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamservicethrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooEx>>, apache::thrift::ThriftPresult> > PubSubStreamingService_responseandstreamservicethrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamboththrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooEx>>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_responseandstreamboththrows_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::integral, ::std::int32_t*>> PubSubStreamingService_returnstreamFast_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > PubSubStreamingService_returnstreamFast_presult; template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_returnstream(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_returnstream, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_returnstream(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_returnstream_pargs args; ::std::int32_t uarg_i32_from{0}; args.get<0>().value = &uarg_i32_from; ::std::int32_t uarg_i32_to{0}; args.get<1>().value = &uarg_i32_to; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.returnstream", serverRequest.requestContext()); try { deserializeRequest(args, "returnstream", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "returnstream"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_returnstream , throw_wrapped_returnstream , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_returnstream(std::move(callback), args.get<0>().ref(), args.get<1>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_returnstream(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_returnstream_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_returnstream_presult::StreamPResultType; auto& returnStream = _return; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("returnstream", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_returnstream(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "returnstream"); return; } } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_streamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_streamthrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_streamthrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_streamthrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.streamthrows", serverRequest.requestContext()); try { deserializeRequest(args, "streamthrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "streamthrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_streamthrows , throw_wrapped_streamthrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_streamthrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_streamthrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_streamthrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_streamthrows_presult::StreamPResultType; auto& returnStream = _return; struct ExMapType { bool operator()(StreamPResultType& res, folly::exception_wrapper ew) { if (ew.with_exception([&]( ::cpp2::FooStreamEx& e) { res.get<1>().ref() = e; res.setIsSet(1, true); })) { return true; } return false; } }; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("streamthrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_streamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "streamthrows"); return; } } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_servicethrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_servicethrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_servicethrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_servicethrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.servicethrows", serverRequest.requestContext()); try { deserializeRequest(args, "servicethrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "servicethrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_servicethrows , throw_wrapped_servicethrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_servicethrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_servicethrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_servicethrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_servicethrows_presult::StreamPResultType; auto& returnStream = _return; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("servicethrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_servicethrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } ::cpp2::PubSubStreamingService_servicethrows_presult result; if (ew.with_exception([&]( ::cpp2::FooEx& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx>(ew, *reqCtx); result.fields.get<0>().ref() = e; result.fields.setIsSet(0, true); } )) {} else { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "servicethrows"); return; } ProtocolOut_ prot; auto response = serializeResponse("servicethrows", &prot, ctx, result.fields); auto payload = std::move(response).extractPayload( req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "servicethrows"); payload.transform(reqCtx->getHeader()->getWriteTransforms()); req->sendStreamReply(std::move(payload), apache::thrift::detail::ServerStreamFactory{nullptr}); } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_servicethrows2(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_servicethrows2, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_servicethrows2(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_servicethrows2_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.servicethrows2", serverRequest.requestContext()); try { deserializeRequest(args, "servicethrows2", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "servicethrows2"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_servicethrows2 , throw_wrapped_servicethrows2 , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_servicethrows2(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_servicethrows2(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_servicethrows2_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_servicethrows2_presult::StreamPResultType; auto& returnStream = _return; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("servicethrows2", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_servicethrows2(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } ::cpp2::PubSubStreamingService_servicethrows2_presult result; if (ew.with_exception([&]( ::cpp2::FooEx& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx>(ew, *reqCtx); result.fields.get<0>().ref() = e; result.fields.setIsSet(0, true); } )) {} else if (ew.with_exception([&]( ::cpp2::FooEx2& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx2>(ew, *reqCtx); result.fields.get<1>().ref() = e; result.fields.setIsSet(1, true); } )) {} else { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "servicethrows2"); return; } ProtocolOut_ prot; auto response = serializeResponse("servicethrows2", &prot, ctx, result.fields); auto payload = std::move(response).extractPayload( req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "servicethrows2"); payload.transform(reqCtx->getHeader()->getWriteTransforms()); req->sendStreamReply(std::move(payload), apache::thrift::detail::ServerStreamFactory{nullptr}); } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_boththrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_boththrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_boththrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_boththrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.boththrows", serverRequest.requestContext()); try { deserializeRequest(args, "boththrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "boththrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_boththrows , throw_wrapped_boththrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_boththrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_boththrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_boththrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_boththrows_presult::StreamPResultType; auto& returnStream = _return; struct ExMapType { bool operator()(StreamPResultType& res, folly::exception_wrapper ew) { if (ew.with_exception([&]( ::cpp2::FooStreamEx& e) { res.get<1>().ref() = e; res.setIsSet(1, true); })) { return true; } return false; } }; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("boththrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_boththrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } ::cpp2::PubSubStreamingService_boththrows_presult result; if (ew.with_exception([&]( ::cpp2::FooEx& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx>(ew, *reqCtx); result.fields.get<0>().ref() = e; result.fields.setIsSet(0, true); } )) {} else { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "boththrows"); return; } ProtocolOut_ prot; auto response = serializeResponse("boththrows", &prot, ctx, result.fields); auto payload = std::move(response).extractPayload( req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "boththrows"); payload.transform(reqCtx->getHeader()->getWriteTransforms()); req->sendStreamReply(std::move(payload), apache::thrift::detail::ServerStreamFactory{nullptr}); } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_responseandstreamstreamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamstreamthrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamstreamthrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_responseandstreamstreamthrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.responseandstreamstreamthrows", serverRequest.requestContext()); try { deserializeRequest(args, "responseandstreamstreamthrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "responseandstreamstreamthrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_responseandstreamstreamthrows , throw_wrapped_responseandstreamstreamthrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_responseandstreamstreamthrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_responseandstreamstreamthrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_responseandstreamstreamthrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_responseandstreamstreamthrows_presult::StreamPResultType; result.get<0>().value = const_cast<::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>::ResponseType*>(&_return.response); result.setIsSet(0, true); auto& returnStream = _return.stream; struct ExMapType { bool operator()(StreamPResultType& res, folly::exception_wrapper ew) { if (ew.with_exception([&]( ::cpp2::FooStreamEx& e) { res.get<1>().ref() = e; res.setIsSet(1, true); })) { return true; } return false; } }; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("responseandstreamstreamthrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_responseandstreamstreamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "responseandstreamstreamthrows"); return; } } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_responseandstreamservicethrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamservicethrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamservicethrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_responseandstreamservicethrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.responseandstreamservicethrows", serverRequest.requestContext()); try { deserializeRequest(args, "responseandstreamservicethrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "responseandstreamservicethrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_responseandstreamservicethrows , throw_wrapped_responseandstreamservicethrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_responseandstreamservicethrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_responseandstreamservicethrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_responseandstreamservicethrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_responseandstreamservicethrows_presult::StreamPResultType; result.get<0>().value = const_cast<::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>::ResponseType*>(&_return.response); result.setIsSet(0, true); auto& returnStream = _return.stream; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("responseandstreamservicethrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_responseandstreamservicethrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } ::cpp2::PubSubStreamingService_responseandstreamservicethrows_presult result; if (ew.with_exception([&]( ::cpp2::FooEx& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx>(ew, *reqCtx); result.fields.get<1>().ref() = e; result.fields.setIsSet(1, true); } )) {} else { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "responseandstreamservicethrows"); return; } ProtocolOut_ prot; auto response = serializeResponse("responseandstreamservicethrows", &prot, ctx, result.fields); auto payload = std::move(response).extractPayload( req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "responseandstreamservicethrows"); payload.transform(reqCtx->getHeader()->getWriteTransforms()); req->sendStreamReply(std::move(payload), apache::thrift::detail::ServerStreamFactory{nullptr}); } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_responseandstreamboththrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, &PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamboththrows, this); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_responseandstreamboththrows(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_responseandstreamboththrows_pargs args; ::std::int32_t uarg_foo{0}; args.get<0>().value = &uarg_foo; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.responseandstreamboththrows", serverRequest.requestContext()); try { deserializeRequest(args, "responseandstreamboththrows", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "responseandstreamboththrows"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_responseandstreamboththrows , throw_wrapped_responseandstreamboththrows , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_tm_responseandstreamboththrows(std::move(callback), args.get<0>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_responseandstreamboththrows(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_responseandstreamboththrows_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_responseandstreamboththrows_presult::StreamPResultType; result.get<0>().value = const_cast<::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>::ResponseType*>(&_return.response); result.setIsSet(0, true); auto& returnStream = _return.stream; struct ExMapType { bool operator()(StreamPResultType& res, folly::exception_wrapper ew) { if (ew.with_exception([&]( ::cpp2::FooStreamEx& e) { res.get<1>().ref() = e; res.setIsSet(1, true); })) { return true; } return false; } }; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("responseandstreamboththrows", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_responseandstreamboththrows(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } ::cpp2::PubSubStreamingService_responseandstreamboththrows_presult result; if (ew.with_exception([&]( ::cpp2::FooEx& e) { if (ctx) { ctx->userExceptionWrapped(true, ew); } ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx); ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::FooEx>(ew, *reqCtx); result.fields.get<1>().ref() = e; result.fields.setIsSet(1, true); } )) {} else { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "responseandstreamboththrows"); return; } ProtocolOut_ prot; auto response = serializeResponse("responseandstreamboththrows", &prot, ctx, result.fields); auto payload = std::move(response).extractPayload( req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "responseandstreamboththrows"); payload.transform(reqCtx->getHeader()->getWriteTransforms()); req->sendStreamReply(std::move(payload), apache::thrift::detail::ServerStreamFactory{nullptr}); } template void PubSubStreamingServiceAsyncProcessor::setUpAndProcess_returnstreamFast(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, nullptr, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, iface_)) { return; } if (!req->getShouldStartProcessing()) { apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb); return; } apache::thrift::ServerRequest serverRequest{std::move(req), std::move(serializedRequest), ctx, {}, {}, {}, {}}; executeRequest_returnstreamFast(std::move(serverRequest)); } template void PubSubStreamingServiceAsyncProcessor::executeRequest_returnstreamFast(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); ::cpp2::PubSubStreamingService_returnstreamFast_pargs args; ::std::int32_t uarg_i32_from{0}; args.get<0>().value = &uarg_i32_from; ::std::int32_t uarg_i32_to{0}; args.get<1>().value = &uarg_i32_to; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "PubSubStreamingService.returnstreamFast", serverRequest.requestContext()); try { deserializeRequest(args, "returnstreamFast", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "returnstreamFast"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = std::make_unique>>( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , return_returnstreamFast , throw_wrapped_returnstreamFast , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , nullptr , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); iface_->async_eb_returnstreamFast(std::move(callback), args.get<0>().ref(), args.get<1>().ref()); } template apache::thrift::ResponseAndServerStreamFactory PubSubStreamingServiceAsyncProcessor::return_returnstreamFast(apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, ::apache::thrift::ServerStream<::std::int32_t>&& _return) { ProtocolOut_ prot; ::cpp2::PubSubStreamingService_returnstreamFast_presult::FieldsType result; using StreamPResultType = ::cpp2::PubSubStreamingService_returnstreamFast_presult::StreamPResultType; auto& returnStream = _return; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; auto encodedStream = apache::thrift::detail::ap::encode_server_stream(std::move(returnStream), std::move(executor)); return {serializeResponse("returnstreamFast", &prot, ctx, result), std::move(encodedStream)}; } template void PubSubStreamingServiceAsyncProcessor::throw_wrapped_returnstreamFast(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "returnstreamFast"); return; } } } // namespace cpp2