/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

    package com.ywt.gapi.message;

import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.PathResolver;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.ServerService;
import org.apache.dubbo.rpc.TriRpcStatus;
import org.apache.dubbo.rpc.model.MethodDescriptor;
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.model.StubMethodDescriptor;
import org.apache.dubbo.rpc.model.StubServiceDescriptor;
import org.apache.dubbo.rpc.stub.BiStreamMethodHandler;
import org.apache.dubbo.rpc.stub.ServerStreamMethodHandler;
import org.apache.dubbo.rpc.stub.StubInvocationUtil;
import org.apache.dubbo.rpc.stub.StubInvoker;
import org.apache.dubbo.rpc.stub.StubMethodHandler;
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.stub.UnaryStubMethodHandler;

import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;

public final class DubboWeChatMessageServiceTriple {

    public static final String SERVICE_NAME = WeChatMessageService.SERVICE_NAME;

    private static final StubServiceDescriptor serviceDescriptor = new StubServiceDescriptor(SERVICE_NAME,WeChatMessageService.class);

    static {
        org.apache.dubbo.rpc.protocol.tri.service.SchemaDescriptorRegistry.addSchemaDescriptor(SERVICE_NAME,MessageProto.getDescriptor());
        StubSuppliers.addSupplier(SERVICE_NAME, DubboWeChatMessageServiceTriple::newStub);
        StubSuppliers.addSupplier(WeChatMessageService.JAVA_SERVICE_NAME,  DubboWeChatMessageServiceTriple::newStub);
        StubSuppliers.addDescriptor(SERVICE_NAME, serviceDescriptor);
        StubSuppliers.addDescriptor(WeChatMessageService.JAVA_SERVICE_NAME, serviceDescriptor);
    }

    @SuppressWarnings("all")
    public static WeChatMessageService newStub(Invoker<?> invoker) {
        return new WeChatMessageServiceStub((Invoker<WeChatMessageService>)invoker);
    }

    /**
         * <pre>
         *  调用终端
         * </pre>
         */
    private static final StubMethodDescriptor sendTemplateMessageMethod = new StubMethodDescriptor("sendTemplateMessage",
    com.ywt.gapi.message.SendTemplateMessageRequest.class, com.ywt.gapi.message.SendTemplateMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendTemplateMessageAsyncMethod = new StubMethodDescriptor("sendTemplateMessage",
    com.ywt.gapi.message.SendTemplateMessageRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendTemplateMessageProxyAsyncMethod = new StubMethodDescriptor("sendTemplateMessageAsync",
    com.ywt.gapi.message.SendTemplateMessageRequest.class, com.ywt.gapi.message.SendTemplateMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageResponse::parseFrom);

    /**
         * <pre>
         *  调用服务名称
         * </pre>
         */
    private static final StubMethodDescriptor sendCustomMessageMethod = new StubMethodDescriptor("sendCustomMessage",
    com.ywt.gapi.message.SendCustomMessageRequest.class, com.ywt.gapi.message.SendCustomMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendCustomMessageRequest::parseFrom,
    com.ywt.gapi.message.SendCustomMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendCustomMessageAsyncMethod = new StubMethodDescriptor("sendCustomMessage",
    com.ywt.gapi.message.SendCustomMessageRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendCustomMessageRequest::parseFrom,
    com.ywt.gapi.message.SendCustomMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendCustomMessageProxyAsyncMethod = new StubMethodDescriptor("sendCustomMessageAsync",
    com.ywt.gapi.message.SendCustomMessageRequest.class, com.ywt.gapi.message.SendCustomMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendCustomMessageRequest::parseFrom,
    com.ywt.gapi.message.SendCustomMessageResponse::parseFrom);

    /**
         * <pre>
         *  IP
         * </pre>
         */
    private static final StubMethodDescriptor sendTemplateMessageAsynckMethod = new StubMethodDescriptor("sendTemplateMessageAsynck",
    com.ywt.gapi.message.SendTemplateMessageAsyncRequest.class, com.ywt.gapi.message.SendTemplateMessageAsyncResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageAsyncRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageAsyncResponse::parseFrom);

    private static final StubMethodDescriptor sendTemplateMessageAsynckAsyncMethod = new StubMethodDescriptor("sendTemplateMessageAsynck",
    com.ywt.gapi.message.SendTemplateMessageAsyncRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageAsyncRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageAsyncResponse::parseFrom);

    private static final StubMethodDescriptor sendTemplateMessageAsynckProxyAsyncMethod = new StubMethodDescriptor("sendTemplateMessageAsynckAsync",
    com.ywt.gapi.message.SendTemplateMessageAsyncRequest.class, com.ywt.gapi.message.SendTemplateMessageAsyncResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendTemplateMessageAsyncRequest::parseFrom,
    com.ywt.gapi.message.SendTemplateMessageAsyncResponse::parseFrom);

    /**
         * <pre>
         *  方法名
         * </pre>
         */
    private static final StubMethodDescriptor sendMPTemplateMessageMethod = new StubMethodDescriptor("sendMPTemplateMessage",
    com.ywt.gapi.message.SendMPTemplateMessageRequest.class, com.ywt.gapi.message.SendMPTemplateMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendMPTemplateMessageAsyncMethod = new StubMethodDescriptor("sendMPTemplateMessage",
    com.ywt.gapi.message.SendMPTemplateMessageRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendMPTemplateMessageProxyAsyncMethod = new StubMethodDescriptor("sendMPTemplateMessageAsync",
    com.ywt.gapi.message.SendMPTemplateMessageRequest.class, com.ywt.gapi.message.SendMPTemplateMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageResponse::parseFrom);

    /**
         * <pre>
         *  网关鉴权信息
         * </pre>
         */
    private static final StubMethodDescriptor sendMPTemplateMessageByLogIdMethod = new StubMethodDescriptor("sendMPTemplateMessageByLogId",
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest.class, com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse::parseFrom);

    private static final StubMethodDescriptor sendMPTemplateMessageByLogIdAsyncMethod = new StubMethodDescriptor("sendMPTemplateMessageByLogId",
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse::parseFrom);

    private static final StubMethodDescriptor sendMPTemplateMessageByLogIdProxyAsyncMethod = new StubMethodDescriptor("sendMPTemplateMessageByLogIdAsync",
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest.class, com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse::parseFrom);

    /**
         * <pre>
         *  其他额外信息
         * </pre>
         */
    private static final StubMethodDescriptor sendMPSubscribeMessageMethod = new StubMethodDescriptor("sendMPSubscribeMessage",
    com.ywt.gapi.message.SendMPSubscribeMessageRequest.class, com.ywt.gapi.message.SendMPSubscribeMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendMPSubscribeMessageAsyncMethod = new StubMethodDescriptor("sendMPSubscribeMessage",
    com.ywt.gapi.message.SendMPSubscribeMessageRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendMPSubscribeMessageProxyAsyncMethod = new StubMethodDescriptor("sendMPSubscribeMessageAsync",
    com.ywt.gapi.message.SendMPSubscribeMessageRequest.class, com.ywt.gapi.message.SendMPSubscribeMessageResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageResponse::parseFrom);

    private static final StubMethodDescriptor sendMPSubscribeMessageByLogIdMethod = new StubMethodDescriptor("sendMPSubscribeMessageByLogId",
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest.class, com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse::parseFrom);

    private static final StubMethodDescriptor sendMPSubscribeMessageByLogIdAsyncMethod = new StubMethodDescriptor("sendMPSubscribeMessageByLogId",
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse::parseFrom);

    private static final StubMethodDescriptor sendMPSubscribeMessageByLogIdProxyAsyncMethod = new StubMethodDescriptor("sendMPSubscribeMessageByLogIdAsync",
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest.class, com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest::parseFrom,
    com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse::parseFrom);





    public static class WeChatMessageServiceStub implements WeChatMessageService{
        private final Invoker<WeChatMessageService> invoker;

        public WeChatMessageServiceStub(Invoker<WeChatMessageService> invoker) {
            this.invoker = invoker;
        }

            /**
         * <pre>
         *  调用终端
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendTemplateMessageResponse sendTemplateMessage(com.ywt.gapi.message.SendTemplateMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendTemplateMessageMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendTemplateMessageResponse> sendTemplateMessageAsync(com.ywt.gapi.message.SendTemplateMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendTemplateMessageAsyncMethod, request);
        }

            /**
         * <pre>
         *  调用终端
         * </pre>
         */
        @Override
        public void sendTemplateMessage(com.ywt.gapi.message.SendTemplateMessageRequest request, StreamObserver<com.ywt.gapi.message.SendTemplateMessageResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendTemplateMessageMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  调用服务名称
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendCustomMessageResponse sendCustomMessage(com.ywt.gapi.message.SendCustomMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendCustomMessageMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendCustomMessageResponse> sendCustomMessageAsync(com.ywt.gapi.message.SendCustomMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendCustomMessageAsyncMethod, request);
        }

            /**
         * <pre>
         *  调用服务名称
         * </pre>
         */
        @Override
        public void sendCustomMessage(com.ywt.gapi.message.SendCustomMessageRequest request, StreamObserver<com.ywt.gapi.message.SendCustomMessageResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendCustomMessageMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  IP
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendTemplateMessageAsyncResponse sendTemplateMessageAsynck(com.ywt.gapi.message.SendTemplateMessageAsyncRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendTemplateMessageAsynckMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendTemplateMessageAsyncResponse> sendTemplateMessageAsynckAsync(com.ywt.gapi.message.SendTemplateMessageAsyncRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendTemplateMessageAsynckAsyncMethod, request);
        }

            /**
         * <pre>
         *  IP
         * </pre>
         */
        @Override
        public void sendTemplateMessageAsynck(com.ywt.gapi.message.SendTemplateMessageAsyncRequest request, StreamObserver<com.ywt.gapi.message.SendTemplateMessageAsyncResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendTemplateMessageAsynckMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  方法名
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendMPTemplateMessageResponse sendMPTemplateMessage(com.ywt.gapi.message.SendMPTemplateMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendMPTemplateMessageResponse> sendMPTemplateMessageAsync(com.ywt.gapi.message.SendMPTemplateMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageAsyncMethod, request);
        }

            /**
         * <pre>
         *  方法名
         * </pre>
         */
        @Override
        public void sendMPTemplateMessage(com.ywt.gapi.message.SendMPTemplateMessageRequest request, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  网关鉴权信息
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse sendMPTemplateMessageByLogId(com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageByLogIdMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse> sendMPTemplateMessageByLogIdAsync(com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageByLogIdAsyncMethod, request);
        }

            /**
         * <pre>
         *  网关鉴权信息
         * </pre>
         */
        @Override
        public void sendMPTemplateMessageByLogId(com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest request, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendMPTemplateMessageByLogIdMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  其他额外信息
         * </pre>
         */
        @Override
        public com.ywt.gapi.message.SendMPSubscribeMessageResponse sendMPSubscribeMessage(com.ywt.gapi.message.SendMPSubscribeMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendMPSubscribeMessageResponse> sendMPSubscribeMessageAsync(com.ywt.gapi.message.SendMPSubscribeMessageRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageAsyncMethod, request);
        }

            /**
         * <pre>
         *  其他额外信息
         * </pre>
         */
        @Override
        public void sendMPSubscribeMessage(com.ywt.gapi.message.SendMPSubscribeMessageRequest request, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageMethod , request, responseObserver);
        }
        @Override
        public com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse sendMPSubscribeMessageByLogId(com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageByLogIdMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse> sendMPSubscribeMessageByLogIdAsync(com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest request){
            return StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageByLogIdAsyncMethod, request);
        }

        @Override
        public void sendMPSubscribeMessageByLogId(com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest request, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, sendMPSubscribeMessageByLogIdMethod , request, responseObserver);
        }



    }

    public static abstract class WeChatMessageServiceImplBase implements WeChatMessageService, ServerService<WeChatMessageService> {

        private <T, R> BiConsumer<T, StreamObserver<R>> syncToAsync(java.util.function.Function<T, R> syncFun) {
            return new BiConsumer<T, StreamObserver<R>>() {
                @Override
                public void accept(T t, StreamObserver<R> observer) {
                    try {
                        R ret = syncFun.apply(t);
                        observer.onNext(ret);
                        observer.onCompleted();
                    } catch (Throwable e) {
                        observer.onError(e);
                    }
                }
            };
        }

        @Override
        public final Invoker<WeChatMessageService> getInvoker(URL url) {
            PathResolver pathResolver = url.getOrDefaultFrameworkModel()
            .getExtensionLoader(PathResolver.class)
            .getDefaultExtension();
            Map<String,StubMethodHandler<?, ?>> handlers = new HashMap<>();

            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendTemplateMessage" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendTemplateMessageAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendCustomMessage" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendCustomMessageAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendTemplateMessageAsynck" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendTemplateMessageAsynckAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPTemplateMessage" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPTemplateMessageAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPTemplateMessageByLogId" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPTemplateMessageByLogIdAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPSubscribeMessage" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPSubscribeMessageAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPSubscribeMessageByLogId" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/sendMPSubscribeMessageByLogIdAsync" );

            BiConsumer<com.ywt.gapi.message.SendTemplateMessageRequest, StreamObserver<com.ywt.gapi.message.SendTemplateMessageResponse>> sendTemplateMessageFunc = this::sendTemplateMessage;
            handlers.put(sendTemplateMessageMethod.getMethodName(), new UnaryStubMethodHandler<>(sendTemplateMessageFunc));
            BiConsumer<com.ywt.gapi.message.SendTemplateMessageRequest, StreamObserver<com.ywt.gapi.message.SendTemplateMessageResponse>> sendTemplateMessageAsyncFunc = syncToAsync(this::sendTemplateMessage);
            handlers.put(sendTemplateMessageProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendTemplateMessageAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendCustomMessageRequest, StreamObserver<com.ywt.gapi.message.SendCustomMessageResponse>> sendCustomMessageFunc = this::sendCustomMessage;
            handlers.put(sendCustomMessageMethod.getMethodName(), new UnaryStubMethodHandler<>(sendCustomMessageFunc));
            BiConsumer<com.ywt.gapi.message.SendCustomMessageRequest, StreamObserver<com.ywt.gapi.message.SendCustomMessageResponse>> sendCustomMessageAsyncFunc = syncToAsync(this::sendCustomMessage);
            handlers.put(sendCustomMessageProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendCustomMessageAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendTemplateMessageAsyncRequest, StreamObserver<com.ywt.gapi.message.SendTemplateMessageAsyncResponse>> sendTemplateMessageAsynckFunc = this::sendTemplateMessageAsynck;
            handlers.put(sendTemplateMessageAsynckMethod.getMethodName(), new UnaryStubMethodHandler<>(sendTemplateMessageAsynckFunc));
            BiConsumer<com.ywt.gapi.message.SendTemplateMessageAsyncRequest, StreamObserver<com.ywt.gapi.message.SendTemplateMessageAsyncResponse>> sendTemplateMessageAsynckAsyncFunc = syncToAsync(this::sendTemplateMessageAsynck);
            handlers.put(sendTemplateMessageAsynckProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendTemplateMessageAsynckAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendMPTemplateMessageRequest, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageResponse>> sendMPTemplateMessageFunc = this::sendMPTemplateMessage;
            handlers.put(sendMPTemplateMessageMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPTemplateMessageFunc));
            BiConsumer<com.ywt.gapi.message.SendMPTemplateMessageRequest, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageResponse>> sendMPTemplateMessageAsyncFunc = syncToAsync(this::sendMPTemplateMessage);
            handlers.put(sendMPTemplateMessageProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPTemplateMessageAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse>> sendMPTemplateMessageByLogIdFunc = this::sendMPTemplateMessageByLogId;
            handlers.put(sendMPTemplateMessageByLogIdMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPTemplateMessageByLogIdFunc));
            BiConsumer<com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest, StreamObserver<com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse>> sendMPTemplateMessageByLogIdAsyncFunc = syncToAsync(this::sendMPTemplateMessageByLogId);
            handlers.put(sendMPTemplateMessageByLogIdProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPTemplateMessageByLogIdAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendMPSubscribeMessageRequest, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageResponse>> sendMPSubscribeMessageFunc = this::sendMPSubscribeMessage;
            handlers.put(sendMPSubscribeMessageMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPSubscribeMessageFunc));
            BiConsumer<com.ywt.gapi.message.SendMPSubscribeMessageRequest, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageResponse>> sendMPSubscribeMessageAsyncFunc = syncToAsync(this::sendMPSubscribeMessage);
            handlers.put(sendMPSubscribeMessageProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPSubscribeMessageAsyncFunc));
            BiConsumer<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse>> sendMPSubscribeMessageByLogIdFunc = this::sendMPSubscribeMessageByLogId;
            handlers.put(sendMPSubscribeMessageByLogIdMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPSubscribeMessageByLogIdFunc));
            BiConsumer<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest, StreamObserver<com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse>> sendMPSubscribeMessageByLogIdAsyncFunc = syncToAsync(this::sendMPSubscribeMessageByLogId);
            handlers.put(sendMPSubscribeMessageByLogIdProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(sendMPSubscribeMessageByLogIdAsyncFunc));




            return new StubInvoker<>(this, url, WeChatMessageService.class, handlers);
        }


        @Override
        public com.ywt.gapi.message.SendTemplateMessageResponse sendTemplateMessage(com.ywt.gapi.message.SendTemplateMessageRequest request){
            throw unimplementedMethodException(sendTemplateMessageMethod);
        }

        @Override
        public com.ywt.gapi.message.SendCustomMessageResponse sendCustomMessage(com.ywt.gapi.message.SendCustomMessageRequest request){
            throw unimplementedMethodException(sendCustomMessageMethod);
        }

        @Override
        public com.ywt.gapi.message.SendTemplateMessageAsyncResponse sendTemplateMessageAsynck(com.ywt.gapi.message.SendTemplateMessageAsyncRequest request){
            throw unimplementedMethodException(sendTemplateMessageAsynckMethod);
        }

        @Override
        public com.ywt.gapi.message.SendMPTemplateMessageResponse sendMPTemplateMessage(com.ywt.gapi.message.SendMPTemplateMessageRequest request){
            throw unimplementedMethodException(sendMPTemplateMessageMethod);
        }

        @Override
        public com.ywt.gapi.message.SendMPTemplateMessageByLogIdResponse sendMPTemplateMessageByLogId(com.ywt.gapi.message.SendMPTemplateMessageByLogIdRequest request){
            throw unimplementedMethodException(sendMPTemplateMessageByLogIdMethod);
        }

        @Override
        public com.ywt.gapi.message.SendMPSubscribeMessageResponse sendMPSubscribeMessage(com.ywt.gapi.message.SendMPSubscribeMessageRequest request){
            throw unimplementedMethodException(sendMPSubscribeMessageMethod);
        }

        @Override
        public com.ywt.gapi.message.SendMPSubscribeMessageByLogIdResponse sendMPSubscribeMessageByLogId(com.ywt.gapi.message.SendMPSubscribeMessageByLogIdRequest request){
            throw unimplementedMethodException(sendMPSubscribeMessageByLogIdMethod);
        }





        @Override
        public final ServiceDescriptor getServiceDescriptor() {
            return serviceDescriptor;
        }
        private RpcException unimplementedMethodException(StubMethodDescriptor methodDescriptor) {
            return TriRpcStatus.UNIMPLEMENTED.withDescription(String.format("Method %s is unimplemented",
                "/" + serviceDescriptor.getInterfaceName() + "/" + methodDescriptor.getMethodName())).asException();
        }
    }

}
