You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2020/11/03 15:40:26 UTC
[dubbo-go-samples] branch makefile updated: make grpc work with
integration test
This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch makefile
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/makefile by this push:
new d3983a0 make grpc work with integration test
d3983a0 is described below
commit d3983a06767984b621a8e4d0b3590f7bf45df5b8
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Tue Nov 3 23:39:57 2020 +0800
make grpc work with integration test
---
general/grpc/go-client/app/Makefile | 2 -
general/grpc/go-client/app/helloworld.pb.go | 284 ---------------------
general/grpc/go-client/assembly/bin/load.sh | 203 ---------------
.../grpc/go-client/assembly/common/app.properties | 23 --
general/grpc/go-client/assembly/common/build.sh | 83 ------
general/grpc/go-client/assembly/linux/dev.sh | 36 ---
general/grpc/go-client/assembly/linux/release.sh | 35 ---
general/grpc/go-client/assembly/linux/test.sh | 35 ---
general/grpc/go-client/assembly/mac/dev.sh | 36 ---
general/grpc/go-client/assembly/mac/release.sh | 34 ---
general/grpc/go-client/assembly/mac/test.sh | 34 ---
general/grpc/go-client/assembly/windows/dev.sh | 34 ---
general/grpc/go-client/assembly/windows/release.sh | 34 ---
general/grpc/go-client/assembly/windows/test.sh | 34 ---
general/grpc/go-client/{app => cmd}/client.go | 55 +---
.../{profiles/release => conf}/client.yml | 36 ++-
.../profiles/dev => go-client/conf}/log.yml | 55 ++--
general/grpc/go-client/{app => pkg}/hello.go | 21 +-
general/grpc/go-client/profiles/release/log.yml | 28 --
general/grpc/go-client/profiles/test/client.yml | 63 -----
general/grpc/go-client/profiles/test/log.yml | 28 --
general/grpc/go-server/app/helloworld.proto | 37 ---
general/grpc/go-server/app/version.go | 22 --
general/grpc/go-server/assembly/bin/load.sh | 151 -----------
.../grpc/go-server/assembly/common/app.properties | 23 --
general/grpc/go-server/assembly/common/build.sh | 80 ------
general/grpc/go-server/assembly/linux/dev.sh | 36 ---
general/grpc/go-server/assembly/linux/release.sh | 36 ---
general/grpc/go-server/assembly/linux/test.sh | 36 ---
general/grpc/go-server/assembly/mac/dev.sh | 36 ---
general/grpc/go-server/assembly/mac/release.sh | 36 ---
general/grpc/go-server/assembly/mac/test.sh | 36 ---
general/grpc/go-server/assembly/windows/dev.sh | 36 ---
general/grpc/go-server/assembly/windows/release.sh | 36 ---
general/grpc/go-server/assembly/windows/test.sh | 36 ---
general/grpc/go-server/{app => cmd}/server.go | 8 +-
.../profiles/dev => go-server/conf}/client.yml | 40 ++-
.../profiles/dev => go-server/conf}/log.yml | 55 ++--
.../go-server/{profiles/test => conf}/server.yml | 26 +-
general/grpc/go-server/docker/docker-compose.yml | 9 +
general/grpc/go-server/{app => pkg}/greeter.go | 19 +-
general/grpc/go-server/profiles/dev/server.yml | 57 -----
general/grpc/go-server/profiles/release/log.yml | 28 --
general/grpc/go-server/profiles/release/server.yml | 54 ----
general/grpc/go-server/profiles/test/log.yml | 28 --
.../tests/integration/greeter_test.go} | 22 +-
.../server.go => tests/integration/main_test.go} | 61 ++---
general/grpc/java-client/build.sh | 21 --
general/grpc/java-client/pom.xml | 247 ------------------
.../java-client/src/main/assembly/assembly.xml | 39 ---
.../src/main/assembly/conf/dubbo.properties | 13 -
.../src/main/assembly/conf/log4j.properties | 19 --
.../src/main/java/com/ikurento/user/Consumer.java | 111 --------
.../java-client/src/main/proto/UserService.proto | 56 ----
.../resources/META-INF/spring/dubbo.consumer.xml | 43 ----
.../src/main/resources/META-INF/spring/service.xml | 36 ---
.../src/main/resources/log4j.properties | 19 --
general/grpc/java-server/build.sh | 20 --
general/grpc/java-server/pom.xml | 225 ----------------
general/grpc/java-server/script/debug.sh | 22 --
.../java-server/src/main/assembly/assembly.xml | 45 ----
.../java-server/src/main/assembly/bin/start.bat | 44 ----
.../java-server/src/main/assembly/bin/start.sh | 125 ---------
.../src/main/assembly/conf/dubbo.properties | 14 -
.../src/main/assembly/conf/log4j.properties | 20 --
.../src/main/java/com/ikurento/user/Provider.java | 34 ---
.../java/com/ikurento/user/UserProviderImpl.java | 70 -----
.../java-server/src/main/proto/UserService.proto | 56 ----
.../resources/META-INF/spring/dubbo.provider.xml | 39 ---
.../src/main/resources/log4j.properties | 20 --
.../{go-server/app => protobuf}/helloworld.pb.go | 63 +++--
.../{go-client/app => protobuf}/helloworld.proto | 4 +-
general/grpc/protobuf/protobuf.mk | 26 ++
go.mod | 5 +-
go.sum | 17 ++
75 files changed, 260 insertions(+), 3430 deletions(-)
diff --git a/general/grpc/go-client/app/Makefile b/general/grpc/go-client/app/Makefile
deleted file mode 100644
index be60da1..0000000
--- a/general/grpc/go-client/app/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-gen:
- protoc -I ./ helloworld.proto --go_out=plugins=grpc:.
diff --git a/general/grpc/go-client/app/helloworld.pb.go b/general/grpc/go-client/app/helloworld.pb.go
deleted file mode 100644
index 75e18b9..0000000
--- a/general/grpc/go-client/app/helloworld.pb.go
+++ /dev/null
@@ -1,284 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: helloworld.proto
-
-package main
-
-import (
- "context"
- "fmt"
- "math"
-
- "github.com/golang/protobuf/proto"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-)
-
-import (
- "github.com/apache/dubbo-go/protocol"
- dgrpc "github.com/apache/dubbo-go/protocol/grpc"
- "github.com/apache/dubbo-go/protocol/invocation"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-// The request message containing the user's name.
-type HelloRequest struct {
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *HelloRequest) Reset() { *m = HelloRequest{} }
-func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
-func (*HelloRequest) ProtoMessage() {}
-func (*HelloRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_17b8c58d586b62f2, []int{0}
-}
-
-func (m *HelloRequest) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_HelloRequest.Unmarshal(m, b)
-}
-func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic)
-}
-func (m *HelloRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_HelloRequest.Merge(m, src)
-}
-func (m *HelloRequest) XXX_Size() int {
- return xxx_messageInfo_HelloRequest.Size(m)
-}
-func (m *HelloRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_HelloRequest.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HelloRequest proto.InternalMessageInfo
-
-func (m *HelloRequest) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-// The response message containing the greetings
-type HelloReply struct {
- Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *HelloReply) Reset() { *m = HelloReply{} }
-func (m *HelloReply) String() string { return proto.CompactTextString(m) }
-func (*HelloReply) ProtoMessage() {}
-func (*HelloReply) Descriptor() ([]byte, []int) {
- return fileDescriptor_17b8c58d586b62f2, []int{1}
-}
-
-func (m *HelloReply) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_HelloReply.Unmarshal(m, b)
-}
-func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic)
-}
-func (m *HelloReply) XXX_Merge(src proto.Message) {
- xxx_messageInfo_HelloReply.Merge(m, src)
-}
-func (m *HelloReply) XXX_Size() int {
- return xxx_messageInfo_HelloReply.Size(m)
-}
-func (m *HelloReply) XXX_DiscardUnknown() {
- xxx_messageInfo_HelloReply.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_HelloReply proto.InternalMessageInfo
-
-func (m *HelloReply) GetMessage() string {
- if m != nil {
- return m.Message
- }
- return ""
-}
-
-func init() {
- proto.RegisterType((*HelloRequest)(nil), "main.HelloRequest")
- proto.RegisterType((*HelloReply)(nil), "main.HelloReply")
-}
-
-func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_17b8c58d586b62f2) }
-
-var fileDescriptor_17b8c58d586b62f2 = []byte{
- // 185 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9,
- 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xc9, 0x4d,
- 0xcc, 0xcc, 0x53, 0x52, 0xe2, 0xe2, 0xf1, 0x00, 0xc9, 0x04, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97,
- 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81,
- 0xd9, 0x4a, 0x6a, 0x5c, 0x5c, 0x50, 0x35, 0x05, 0x39, 0x95, 0x42, 0x12, 0x5c, 0xec, 0xb9, 0xa9,
- 0xc5, 0xc5, 0x89, 0xe9, 0x30, 0x45, 0x30, 0xae, 0x91, 0x2d, 0x17, 0xbb, 0x7b, 0x51, 0x6a, 0x6a,
- 0x49, 0x6a, 0x91, 0x90, 0x11, 0x17, 0x47, 0x70, 0x62, 0x25, 0x58, 0x97, 0x90, 0x90, 0x1e, 0xc8,
- 0x26, 0x3d, 0x64, 0x6b, 0xa4, 0x04, 0x50, 0xc4, 0x0a, 0x72, 0x2a, 0x95, 0x18, 0x9c, 0xcc, 0xb8,
- 0xa4, 0x33, 0xf3, 0xf5, 0xd2, 0x8b, 0x0a, 0x92, 0xf5, 0x52, 0x2b, 0x12, 0x73, 0x0b, 0x72, 0x52,
- 0x8b, 0xf5, 0x10, 0xae, 0x76, 0xe2, 0x07, 0x2b, 0x0e, 0x07, 0xb1, 0x03, 0x40, 0x1e, 0x08, 0x60,
- 0x5c, 0xc4, 0xc4, 0xec, 0xe1, 0x13, 0x9e, 0xc4, 0x06, 0xf6, 0x8f, 0x31, 0x20, 0x00, 0x00, 0xff,
- 0xff, 0xd2, 0x16, 0x5f, 0x34, 0xe3, 0x00, 0x00, 0x00,
-}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConn
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
-
-// GreeterClient is the client API for Greeter service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type GreeterClient interface {
- // Sends a greeting
- SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
-}
-
-type greeterClient struct {
- cc *grpc.ClientConn
-}
-
-func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
- return &greeterClient{cc}
-}
-
-func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
- out := new(HelloReply)
- err := c.cc.Invoke(ctx, "/main.Greeter/SayHello", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// GreeterServer is the server API for Greeter service.
-type GreeterServer interface {
- // Sends a greeting
- SayHello(context.Context, *HelloRequest) (*HelloReply, error)
-}
-
-// UnimplementedGreeterServer can be embedded to have forward compatible implementations.
-type UnimplementedGreeterServer struct {
-}
-
-func (*UnimplementedGreeterServer) SayHello(ctx context.Context, req *HelloRequest) (*HelloReply, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
-}
-
-func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
- s.RegisterService(&_Greeter_serviceDesc, srv)
-}
-
-func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(HelloRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(GreeterServer).SayHello(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/main.Greeter/SayHello",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _Greeter_serviceDesc = grpc.ServiceDesc{
- ServiceName: "main.Greeter",
- HandlerType: (*GreeterServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "SayHello",
- Handler: _Greeter_SayHello_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "helloworld.proto",
-}
-
-// GreeterClientImpl is the client API for Greeter service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type GreeterClientImpl struct {
- // Sends a greeting
- SayHello func(ctx context.Context, in *HelloRequest, out *HelloReply) error
-}
-
-func (c *GreeterClientImpl) Reference() string {
- return "greeterImpl"
-}
-
-func (c *GreeterClientImpl) GetDubboStub(cc *grpc.ClientConn) GreeterClient {
- return NewGreeterClient(cc)
-}
-
-type GreeterProviderBase struct {
- proxyImpl protocol.Invoker
-}
-
-func (s *GreeterProviderBase) SetProxyImpl(impl protocol.Invoker) {
- s.proxyImpl = impl
-}
-
-func (s *GreeterProviderBase) GetProxyImpl() protocol.Invoker {
- return s.proxyImpl
-}
-
-func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(HelloRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- base := srv.(dgrpc.DubboGrpcService)
- args := []interface{}{}
- args = append(args, in)
- invo := invocation.NewRPCInvocation("SayHello", args, nil)
- if interceptor == nil {
- result := base.GetProxyImpl().Invoke(context.Background(), invo)
- return result.Result(), result.Error()
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/main.Greeter/SayHello",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- result := base.GetProxyImpl().Invoke(context.Background(), invo)
- return result.Result(), result.Error()
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func (s *GreeterProviderBase) ServiceDesc() *grpc.ServiceDesc {
- return &grpc.ServiceDesc{
- ServiceName: "main.Greeter",
- HandlerType: (*GreeterServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "SayHello",
- Handler: _DUBBO_Greeter_SayHello_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "helloworld.proto",
- }
-}
diff --git a/general/grpc/go-client/assembly/bin/load.sh b/general/grpc/go-client/assembly/bin/load.sh
deleted file mode 100644
index ffa240b..0000000
--- a/general/grpc/go-client/assembly/bin/load.sh
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-SLEEP_INTERVAL=5
-MAX_LIFETIME=4000
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-else
- APP_NAME="APPLICATION_NAME.exe"
-fi
-
-export CONF_CONSUMER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-# export GOTRACEBACK=system
-# export GODEBUG=gctrace=1
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default client.yml!"
- else
- export CONF_CONSUMER_FILE_PATH=${CONF_CONSUMER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_CONSUMER_FILE_PATH}" ];then
- echo $CONF_CONSUMER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH=${PROJECT_HOME}"logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-monitor() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- done
-}
-
-crontab() {
- idx=0
- while true; do
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [[ "${PID}" == "" ]]; then
- start
- idx=0
- fi
-
- ((LIFE=idx*${SLEEP_INTERVAL}))
- echo "${APP_NAME} ( pid = " ${PID} ") has been working in normal state for " $LIFE " seconds."
- ((idx ++))
- sleep ${SLEEP_INTERVAL}
- if [[ ${LIFE} -gt ${MAX_LIFETIME} ]]; then
- kill -9 ${PID}
- fi
- done
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- Cmonitor)
- monitor
- ;;
- Ccrontab)
- crontab
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/general/grpc/go-client/assembly/common/app.properties b/general/grpc/go-client/assembly/common/app.properties
deleted file mode 100644
index e10868f..0000000
--- a/general/grpc/go-client/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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.
-
-
-export TARGET_EXEC_NAME="user_info_client"
-# BUILD_PACKAGE="dubbogo-examples/user-info/client/app"
-export BUILD_PACKAGE="app"
-
-export TARGET_CONF_FILE="conf/client.yml"
-export TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/general/grpc/go-client/assembly/common/build.sh b/general/grpc/go-client/assembly/common/build.sh
deleted file mode 100644
index d38f889..0000000
--- a/general/grpc/go-client/assembly/common/build.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE == "dev" || $PROFILE == "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GOOS=$GOOS GOARCH=$GOARCH GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-cd ${BIN_DIR}/bin/ && mv load.sh load_${TARGET_EXEC_NAME}.sh && cd -
-
-platform=$(uname)
-# modify APPLICATION_NAME
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-# modify TARGET_LOG_CONF_FILE
-if [ ${platform} == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/general/grpc/go-client/assembly/linux/dev.sh b/general/grpc/go-client/assembly/linux/dev.sh
deleted file mode 100644
index eada737..0000000
--- a/general/grpc/go-client/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/linux/release.sh b/general/grpc/go-client/assembly/linux/release.sh
deleted file mode 100644
index 10eb3d7..0000000
--- a/general/grpc/go-client/assembly/linux/release.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/linux/test.sh b/general/grpc/go-client/assembly/linux/test.sh
deleted file mode 100644
index 78b650c..0000000
--- a/general/grpc/go-client/assembly/linux/test.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/mac/dev.sh b/general/grpc/go-client/assembly/mac/dev.sh
deleted file mode 100644
index c828476..0000000
--- a/general/grpc/go-client/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="dev"
-
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/mac/release.sh b/general/grpc/go-client/assembly/mac/release.sh
deleted file mode 100644
index 91c2dfe..0000000
--- a/general/grpc/go-client/assembly/mac/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/mac/test.sh b/general/grpc/go-client/assembly/mac/test.sh
deleted file mode 100644
index a7853f5..0000000
--- a/general/grpc/go-client/assembly/mac/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/windows/dev.sh b/general/grpc/go-client/assembly/windows/dev.sh
deleted file mode 100644
index 10a3866..0000000
--- a/general/grpc/go-client/assembly/windows/dev.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-export PROFILE="dev"
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/windows/release.sh b/general/grpc/go-client/assembly/windows/release.sh
deleted file mode 100644
index 21af573..0000000
--- a/general/grpc/go-client/assembly/windows/release.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="release"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/assembly/windows/test.sh b/general/grpc/go-client/assembly/windows/test.sh
deleted file mode 100644
index 2104da8..0000000
--- a/general/grpc/go-client/assembly/windows/test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-export PROFILE="test"
-export PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
- . ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
- sh ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-client/app/client.go b/general/grpc/go-client/cmd/client.go
similarity index 63%
rename from general/grpc/go-client/app/client.go
rename to general/grpc/go-client/cmd/client.go
index d8634b7..4fa2ab3 100644
--- a/general/grpc/go-client/app/client.go
+++ b/general/grpc/go-client/cmd/client.go
@@ -19,21 +19,15 @@ package main
import (
"context"
- "fmt"
- "os"
- "os/signal"
- "syscall"
- "time"
-)
-
-import (
+ "github.com/apache/dubbo-samples/golang/general/grpc/go-client/pkg"
+ "github.com/apache/dubbo-samples/golang/general/grpc/protobuf"
"github.com/dubbogo/gost/log"
+ "time"
)
import (
_ "github.com/apache/dubbo-go/cluster/cluster_impl"
_ "github.com/apache/dubbo-go/cluster/loadbalance"
- "github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/filter_impl"
@@ -43,20 +37,20 @@ import (
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout int = 10e9
-)
+var grpcGreeterImpl = new(pkg.GrpcGreeterImpl)
-// they are necessary:
-// export CONF_CONSUMER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+func init() {
+ config.SetConsumerService(grpcGreeterImpl)
+}
+
+// need to setup environment variable "CONF_CONSUMER_FILE_PATH" to "conf/client.yml" before run
func main() {
config.Load()
- time.Sleep(time.Second)
+ time.Sleep(3 * time.Second)
gxlog.CInfo("\n\n\nstart to test dubbo")
- reply := &HelloReply{}
- req := &HelloRequest{
+ reply := &protobuf.HelloReply{}
+ req := &protobuf.HelloRequest{
Name: "xujianhai",
}
err := grpcGreeterImpl.SayHello(context.TODO(), req, reply)
@@ -64,29 +58,4 @@ func main() {
panic(err)
}
gxlog.CInfo("client response result: %v\n", reply)
- initSignal()
-}
-
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
- syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // The program exits normally or timeout forcibly exits.
- fmt.Println("app exit now...")
- return
- }
- }
}
diff --git a/general/grpc/go-client/profiles/release/client.yml b/general/grpc/go-client/conf/client.yml
similarity index 65%
rename from general/grpc/go-client/profiles/release/client.yml
rename to general/grpc/go-client/conf/client.yml
index 265654c..fe24413 100644
--- a/general/grpc/go-client/profiles/release/client.yml
+++ b/general/grpc/go-client/conf/client.yml
@@ -1,42 +1,40 @@
# dubbo client yaml configure file
-
check: true
# client
-request_timeout : "3s"
+request_timeout: "3s"
# connect timeout
-connect_timeout : "3s"
+connect_timeout: "3s"
# application config
application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
-
-registries :
+ organization: "dubbo.io"
+ name: "GreeterGrpcConsumer"
+ module: "dubbo-go greeter grpc client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
"demoZk":
protocol: "zookeeper"
- timeout : "3s"
+ timeout: "3s"
address: "127.0.0.1:2181"
username: ""
password: ""
-
+# reference config
references:
"GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
registry: "demoZk"
- protocol : "grpc"
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
+ protocol: "grpc"
+ interface: "org.apache.dubbo.GreeterGrpc$IGreeter"
cluster: "failover"
- methods :
+ methods:
- name: "SayHello"
retries: 3
-
+# protocol config
protocol_conf:
grpc:
reconnect_interval: 0
@@ -58,4 +56,4 @@ protocol_conf:
tcp_write_timeout: "5s"
wait_timeout: "1s"
max_msg_len: 10240
- session_name: "client"
\ No newline at end of file
+ session_name: "client"
diff --git a/general/grpc/go-server/profiles/dev/log.yml b/general/grpc/go-client/conf/log.yml
similarity index 88%
rename from general/grpc/go-server/profiles/dev/log.yml
rename to general/grpc/go-client/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/general/grpc/go-server/profiles/dev/log.yml
+++ b/general/grpc/go-client/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/general/grpc/go-client/app/hello.go b/general/grpc/go-client/pkg/hello.go
similarity index 72%
rename from general/grpc/go-client/app/hello.go
rename to general/grpc/go-client/pkg/hello.go
index f3e6a8f..ab2d958 100644
--- a/general/grpc/go-client/app/hello.go
+++ b/general/grpc/go-client/pkg/hello.go
@@ -15,34 +15,23 @@
* limitations under the License.
*/
-package main
+package pkg
import (
"context"
-)
-
-import (
+ "github.com/apache/dubbo-samples/golang/general/grpc/protobuf"
"google.golang.org/grpc"
)
-import (
- "github.com/apache/dubbo-go/config"
-)
-
-var grpcGreeterImpl = new(GrpcGreeterImpl)
-
-func init() {
- config.SetConsumerService(grpcGreeterImpl)
-}
type GrpcGreeterImpl struct {
- SayHello func(ctx context.Context, in *HelloRequest, out *HelloReply) error
+ SayHello func(ctx context.Context, in *protobuf.HelloRequest, out *protobuf.HelloReply) error
}
func (u *GrpcGreeterImpl) Reference() string {
return "GrpcGreeterImpl"
}
-func (u *GrpcGreeterImpl) GetDubboStub(cc *grpc.ClientConn) GreeterClient {
- return NewGreeterClient(cc)
+func (u *GrpcGreeterImpl) GetDubboStub(cc *grpc.ClientConn) protobuf.GreeterClient {
+ return protobuf.NewGreeterClient(cc)
}
diff --git a/general/grpc/go-client/profiles/release/log.yml b/general/grpc/go-client/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/general/grpc/go-client/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/grpc/go-client/profiles/test/client.yml b/general/grpc/go-client/profiles/test/client.yml
deleted file mode 100644
index e0c0737..0000000
--- a/general/grpc/go-client/profiles/test/client.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-# dubbo client yaml configure file
-
-
-check: true
-# client
-request_timeout : "3s"
-# connect timeout
-connect_timeout : "3s"
-
-config_center:
- protocol: "zookeeper"
- address: "127.0.0.1:2181"
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "demoZk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
- username: ""
- password: ""
-
-references:
- "GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "demoZk"
- protocol : "grpc"
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
- cluster: "failover"
- methods :
- - name: "SayHello"
- retries: 3
-
-
-protocol_conf:
- grpc:
- reconnect_interval: 0
- connection_number: 2
- heartbeat_period: "5s"
- session_timeout: "20s"
- pool_size: 64
- pool_ttl: 600
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 10240
- session_name: "client"
\ No newline at end of file
diff --git a/general/grpc/go-client/profiles/test/log.yml b/general/grpc/go-client/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/general/grpc/go-client/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/grpc/go-server/app/helloworld.proto b/general/grpc/go-server/app/helloworld.proto
deleted file mode 100644
index d68e1dd..0000000
--- a/general/grpc/go-server/app/helloworld.proto
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 The gRPC Authors
-//
-// Licensed 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.
-syntax = "proto3";
-
-option java_multiple_files = true;
-option java_package = "io.grpc.examples.helloworld";
-option java_outer_classname = "HelloWorldProto";
-option objc_class_prefix = "HLW";
-
-package main;
-
-// The greeting service definition.
-service Greeter {
- // Sends a greeting
- rpc SayHello (HelloRequest) returns (HelloReply) {}
-}
-
-// The request message containing the user's name.
-message HelloRequest {
- string name = 1;
-}
-
-// The response message containing the greetings
-message HelloReply {
- string message = 1;
-}
diff --git a/general/grpc/go-server/app/version.go b/general/grpc/go-server/app/version.go
deleted file mode 100644
index ae51f45..0000000
--- a/general/grpc/go-server/app/version.go
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 main
-
-var (
- Version = "2.7.5"
-)
diff --git a/general/grpc/go-server/assembly/bin/load.sh b/general/grpc/go-server/assembly/bin/load.sh
deleted file mode 100644
index 90077c2..0000000
--- a/general/grpc/go-server/assembly/bin/load.sh
+++ /dev/null
@@ -1,151 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-APP_NAME="APPLICATION_NAME"
-APP_ARGS=""
-
-
-PROJECT_HOME=""
-OS_NAME=`uname`
-if [[ ${OS_NAME} != "Windows" ]]; then
- PROJECT_HOME=`pwd`
- PROJECT_HOME=${PROJECT_HOME}"/"
-fi
-
-export CONF_PROVIDER_FILE_PATH=${PROJECT_HOME}"TARGET_CONF_FILE"
-export APP_LOG_CONF_FILE=${PROJECT_HOME}"TARGET_LOG_CONF_FILE"
-
-usage() {
- echo "Usage: $0 start [conf suffix]"
- echo " $0 stop"
- echo " $0 term"
- echo " $0 restart"
- echo " $0 list"
- echo " $0 monitor"
- echo " $0 crontab"
- exit
-}
-
-start() {
- arg=$1
- if [ "$arg" = "" ];then
- echo "No registry type! Default server.yml!"
- else
- export CONF_PROVIDER_FILE_PATH=${CONF_PROVIDER_FILE_PATH//\.yml/\_$arg\.yml}
- fi
- if [ ! -f "${CONF_PROVIDER_FILE_PATH}" ];then
- echo $CONF_PROVIDER_FILE_PATH" is not existing!"
- return
- fi
- APP_LOG_PATH="${PROJECT_HOME}logs/"
- mkdir -p ${APP_LOG_PATH}
- APP_BIN=${PROJECT_HOME}sbin/${APP_NAME}
- chmod u+x ${APP_BIN}
- # CMD="nohup ${APP_BIN} ${APP_ARGS} >>${APP_NAME}.nohup.out 2>&1 &"
- CMD="${APP_BIN}"
- eval ${CMD}
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- CUR=`date +%FT%T`
- if [ "${PID}" != "" ]; then
- for p in ${PID}
- do
- echo "start ${APP_NAME} ( pid =" ${p} ") at " ${CUR}
- done
- fi
-}
-
-stop() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -SIGINT ${APP_NAME} ( pid =" ${ps} ")"
- kill -2 ${ps}
- done
- fi
-}
-
-
-term() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $2}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{print $1}'`
- fi
- if [ "${PID}" != "" ];
- then
- for ps in ${PID}
- do
- echo "kill -9 ${APP_NAME} ( pid =" ${ps} ")"
- kill -9 ${ps}
- done
- fi
-}
-
-list() {
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s\n", $1, $2, $9, $10)}'`
- if [[ ${OS_NAME} != "Linux" && ${OS_NAME} != "Darwin" ]]; then
- PID=`ps aux | grep -w ${APP_NAME} | grep -v grep | awk '{printf("%s,%s,%s,%s,%s\n", $1, $4, $6, $7, $8)}'`
- fi
-
- if [ "${PID}" != "" ]; then
- echo "list ${APP_NAME}"
-
- if [[ ${OS_NAME} == "Linux" || ${OS_NAME} == "Darwin" ]]; then
- echo "index: user, pid, start, duration"
- else
- echo "index: PID, WINPID, UID, STIME, COMMAND"
- fi
- idx=0
- for ps in ${PID}
- do
- echo "${idx}: ${ps}"
- ((idx ++))
- done
- fi
-}
-
-opt=$1
-case C"$opt" in
- Cstart)
- start $2
- ;;
- Cstop)
- stop
- ;;
- Cterm)
- term
- ;;
- Crestart)
- term
- start $2
- ;;
- Clist)
- list
- ;;
- C*)
- usage
- ;;
-esac
-
diff --git a/general/grpc/go-server/assembly/common/app.properties b/general/grpc/go-server/assembly/common/app.properties
deleted file mode 100644
index 1f0827e..0000000
--- a/general/grpc/go-server/assembly/common/app.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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.
-
-
-TARGET_EXEC_NAME="user_info_server"
-# BUILD_PACKAGE="dubbogo-examples/user-info/server/app"
-BUILD_PACKAGE="app"
-
-TARGET_CONF_FILE="conf/server.yml"
-TARGET_LOG_CONF_FILE="conf/log.yml"
diff --git a/general/grpc/go-server/assembly/common/build.sh b/general/grpc/go-server/assembly/common/build.sh
deleted file mode 100644
index d90d026..0000000
--- a/general/grpc/go-server/assembly/common/build.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-rm -rf target/
-
-PROJECT_HOME=`pwd`
-TARGET_FOLDER=${PROJECT_HOME}/target/${GOOS}
-
-TARGET_SBIN_NAME=${TARGET_EXEC_NAME}
-version=`cat app/version.go | grep Version | grep -v "Apache" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}'`
-if [[ ${GOOS} == "windows" ]]; then
- TARGET_SBIN_NAME=${TARGET_SBIN_NAME}.exe
-fi
-TARGET_NAME=${TARGET_FOLDER}/${TARGET_SBIN_NAME}
-if [[ $PROFILE = "test" ]]; then
- # GFLAGS=-gcflags "-N -l" -race -x -v # -x会把go build的详细过程输出
- # GFLAGS=-gcflags "-N -l" -race -v
- # GFLAGS="-gcflags \"-N -l\" -v"
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -gcflags "-N -l" -x -v -i -o ${TARGET_NAME} && cd -
-else
- # -s去掉符号表(然后panic时候的stack trace就没有任何文件名/行号信息了,这个等价于普通C/C++程序被strip的效果),
- # -w去掉DWARF调试信息,得到的程序就不能用gdb调试了。-s和-w也可以分开使用,一般来说如果不打算用gdb调试,
- # -w基本没啥损失。-s的损失就有点大了。
- cd ${BUILD_PACKAGE} && GO111MODULE=on go build -ldflags "-w" -x -v -i -o ${TARGET_NAME} && cd -
-fi
-
-TAR_NAME=${TARGET_EXEC_NAME}-${version}-`date "+%Y%m%d-%H%M"`-${PROFILE}
-
-mkdir -p ${TARGET_FOLDER}/${TAR_NAME}
-
-SBIN_DIR=${TARGET_FOLDER}/${TAR_NAME}/sbin
-BIN_DIR=${TARGET_FOLDER}/${TAR_NAME}
-CONF_DIR=${TARGET_FOLDER}/${TAR_NAME}/conf
-
-mkdir -p ${SBIN_DIR}
-mkdir -p ${CONF_DIR}
-
-mv ${TARGET_NAME} ${SBIN_DIR}
-cp -r assembly/bin ${BIN_DIR}
-# modify APPLICATION_NAME
-# OS=`uname`
-# if [[ $OS=="Darwin" ]]; then
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~APPLICATION_NAME~${TARGET_EXEC_NAME}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_CONF_FILE~${TARGET_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-# modify TARGET_LOG_CONF_FILE
-if [ "$(uname)" == "Darwin" ]; then
- sed -i "" "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-else
- sed -i "s~TARGET_LOG_CONF_FILE~${TARGET_LOG_CONF_FILE}~g" ${BIN_DIR}/bin/*
-fi
-
-cp -r profiles/${PROFILE}/* ${CONF_DIR}
-
-cd ${TARGET_FOLDER}
-
-tar czf ${TAR_NAME}.tar.gz ${TAR_NAME}/*
-
diff --git a/general/grpc/go-server/assembly/linux/dev.sh b/general/grpc/go-server/assembly/linux/dev.sh
deleted file mode 100644
index d830ac9..0000000
--- a/general/grpc/go-server/assembly/linux/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/linux/release.sh b/general/grpc/go-server/assembly/linux/release.sh
deleted file mode 100644
index 9930380..0000000
--- a/general/grpc/go-server/assembly/linux/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/linux/test.sh b/general/grpc/go-server/assembly/linux/test.sh
deleted file mode 100644
index 87144bb..0000000
--- a/general/grpc/go-server/assembly/linux/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=linux
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/mac/dev.sh b/general/grpc/go-server/assembly/mac/dev.sh
deleted file mode 100644
index 3a7659b..0000000
--- a/general/grpc/go-server/assembly/mac/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/mac/release.sh b/general/grpc/go-server/assembly/mac/release.sh
deleted file mode 100644
index 1c4bce4..0000000
--- a/general/grpc/go-server/assembly/mac/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/mac/test.sh b/general/grpc/go-server/assembly/mac/test.sh
deleted file mode 100644
index 69206e3..0000000
--- a/general/grpc/go-server/assembly/mac/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-set -e
-
-export GOOS=darwin
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
-
diff --git a/general/grpc/go-server/assembly/windows/dev.sh b/general/grpc/go-server/assembly/windows/dev.sh
deleted file mode 100644
index 011fb41..0000000
--- a/general/grpc/go-server/assembly/windows/dev.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=dev
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/windows/release.sh b/general/grpc/go-server/assembly/windows/release.sh
deleted file mode 100644
index 679a26a..0000000
--- a/general/grpc/go-server/assembly/windows/release.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=release
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/assembly/windows/test.sh b/general/grpc/go-server/assembly/windows/test.sh
deleted file mode 100644
index 4a36de0..0000000
--- a/general/grpc/go-server/assembly/windows/test.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-
-
-set -e
-
-export GOOS=windows
-export GOARCH=amd64
-
-PROFILE=test
-
-PROJECT_HOME=`pwd`
-
-if [ -f "${PROJECT_HOME}/assembly/common/app.properties" ]; then
-. ${PROJECT_HOME}/assembly/common/app.properties
-fi
-
-
-if [ -f "${PROJECT_HOME}/assembly/common/build.sh" ]; then
-. ${PROJECT_HOME}/assembly/common/build.sh
-fi
diff --git a/general/grpc/go-server/app/server.go b/general/grpc/go-server/cmd/server.go
similarity index 90%
copy from general/grpc/go-server/app/server.go
copy to general/grpc/go-server/cmd/server.go
index 2f2d88d..ead9df3 100644
--- a/general/grpc/go-server/app/server.go
+++ b/general/grpc/go-server/cmd/server.go
@@ -19,6 +19,7 @@ package main
import (
"fmt"
+ "github.com/apache/dubbo-samples/golang/general/grpc/go-server/pkg"
"os"
"os/signal"
"syscall"
@@ -41,13 +42,10 @@ var (
survivalTimeout = int(3 * time.Second)
)
-// they are necessary:
-// export CONF_PROVIDER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
+// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
func main() {
-
+ config.SetProviderService(pkg.NewGreeterProvider())
config.Load()
-
initSignal()
}
diff --git a/general/grpc/go-client/profiles/dev/client.yml b/general/grpc/go-server/conf/client.yml
similarity index 61%
rename from general/grpc/go-client/profiles/dev/client.yml
rename to general/grpc/go-server/conf/client.yml
index d04a578..615cd74 100644
--- a/general/grpc/go-client/profiles/dev/client.yml
+++ b/general/grpc/go-server/conf/client.yml
@@ -1,42 +1,40 @@
# dubbo client yaml configure file
-
check: true
# client
-request_timeout : "3s"
+request_timeout: "3s"
# connect timeout
-connect_timeout : "3s"
+connect_timeout: "3s"
# application config
application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
+ organization: "dubbo.io"
+ name: "GreeterGrpcTest"
+ module: "dubbo-go greeter grpc client"
+ version: "0.0.1"
+ environment: "dev"
+
+# registry config
+registries:
"demoZk":
protocol: "zookeeper"
- timeout : "3s"
+ timeout: "3s"
address: "127.0.0.1:2181"
username: ""
password: ""
-
+# reference config
references:
"GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
registry: "demoZk"
- protocol : "grpc"
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
+ protocol: "grpc"
+ interface: "org.apache.dubbo.GreeterGrpc$IGreeter"
cluster: "failover"
- methods :
- - name: "SayHello"
- retries: 3
-
+ methods:
+ - name: "SayHello"
+ retries: 3
+# protocol config
protocol_conf:
grpc:
reconnect_interval: 0
@@ -58,4 +56,4 @@ protocol_conf:
tcp_write_timeout: "5s"
wait_timeout: "1s"
max_msg_len: 10240
- session_name: "client"
\ No newline at end of file
+ session_name: "client"
diff --git a/general/grpc/go-client/profiles/dev/log.yml b/general/grpc/go-server/conf/log.yml
similarity index 88%
rename from general/grpc/go-client/profiles/dev/log.yml
rename to general/grpc/go-server/conf/log.yml
index 59fa427..2b6e93a 100644
--- a/general/grpc/go-client/profiles/dev/log.yml
+++ b/general/grpc/go-server/conf/log.yml
@@ -1,28 +1,27 @@
-
-level: "debug"
-development: true
-disableCaller: false
-disableStacktrace: false
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
+level: "debug"
+development: true
+disableCaller: false
+disableStacktrace: false
+sampling:
+encoding: "console"
+
+# encoder
+encoderConfig:
+ messageKey: "message"
+ levelKey: "level"
+ timeKey: "time"
+ nameKey: "logger"
+ callerKey: "caller"
+ stacktraceKey: "stacktrace"
+ lineEnding: ""
+ levelEncoder: "capital"
+ timeEncoder: "iso8601"
+ durationEncoder: "seconds"
+ callerEncoder: "short"
+ nameEncoder: ""
+
+outputPaths:
+ - "stderr"
+errorOutputPaths:
+ - "stderr"
+initialFields:
diff --git a/general/grpc/go-server/profiles/test/server.yml b/general/grpc/go-server/conf/server.yml
similarity index 67%
rename from general/grpc/go-server/profiles/test/server.yml
rename to general/grpc/go-server/conf/server.yml
index da146ad..14e9ecb 100644
--- a/general/grpc/go-server/profiles/test/server.yml
+++ b/general/grpc/go-server/conf/server.yml
@@ -1,28 +1,26 @@
# dubbo server yaml configure file
-
# application config
application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "test"
+ organization: "dubbo.io"
+ name: "GreeterGrpcServer"
+ module: "dubbo-go greeter grpc server"
+ version: "0.0.1"
+ environment: "dev"
-registries :
+# registry config
+registries:
"demoZk":
protocol: "zookeeper"
- timeout : "3s"
+ timeout: "3s"
address: "127.0.0.1:2181"
+# service config
services:
"GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
registry: "demoZk"
- protocol : "grpc"
- # 相当于dubbo.xml中的interface
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
+ protocol: "grpc"
+ interface: "org.apache.dubbo.GreeterGrpc$IGreeter"
loadbalance: "random"
warmup: "100"
cluster: "failover"
@@ -31,12 +29,12 @@ services:
retries: 1
loadbalance: "random"
+# protocol config
protocols:
"grpc":
name: "grpc"
port: 20000
-
protocol_conf:
grpc:
session_number: 700
diff --git a/general/grpc/go-server/docker/docker-compose.yml b/general/grpc/go-server/docker/docker-compose.yml
new file mode 100644
index 0000000..8724179
--- /dev/null
+++ b/general/grpc/go-server/docker/docker-compose.yml
@@ -0,0 +1,9 @@
+version: '3'
+
+services:
+ zookeeper:
+ image: zookeeper
+ ports:
+ - 2181:2181
+ restart: on-failure
+
diff --git a/general/grpc/go-server/app/greeter.go b/general/grpc/go-server/pkg/greeter.go
similarity index 73%
rename from general/grpc/go-server/app/greeter.go
rename to general/grpc/go-server/pkg/greeter.go
index 709e229..f35daf0 100644
--- a/general/grpc/go-server/app/greeter.go
+++ b/general/grpc/go-server/pkg/greeter.go
@@ -15,34 +15,27 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package main
+package pkg
import (
"context"
"fmt"
+ "github.com/apache/dubbo-samples/golang/general/grpc/protobuf"
)
-import (
- "github.com/apache/dubbo-go/config"
-)
-
-func init() {
- config.SetProviderService(NewGreeterProvider())
-}
-
type GreeterProvider struct {
- *GreeterProviderBase
+ *protobuf.GreeterProviderBase
}
func NewGreeterProvider() *GreeterProvider {
return &GreeterProvider{
- GreeterProviderBase: &GreeterProviderBase{},
+ GreeterProviderBase: &protobuf.GreeterProviderBase{},
}
}
-func (g *GreeterProvider) SayHello(ctx context.Context, req *HelloRequest) (reply *HelloReply, err error) {
+func (g *GreeterProvider) SayHello(ctx context.Context, req *protobuf.HelloRequest) (reply *protobuf.HelloReply, err error) {
fmt.Printf("req: %v", req)
- return &HelloReply{Message: "this is message from reply"}, nil
+ return &protobuf.HelloReply{Message: "this is message from reply"}, nil
}
func (g *GreeterProvider) Reference() string {
diff --git a/general/grpc/go-server/profiles/dev/server.yml b/general/grpc/go-server/profiles/dev/server.yml
deleted file mode 100644
index e0677e4..0000000
--- a/general/grpc/go-server/profiles/dev/server.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-# dubbo server yaml configure file
-
-
-# application config
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "demoZk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
-
-services:
- "GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "demoZk"
- protocol : "grpc"
- # 相当于dubbo.xml中的interface
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "SayHello"
- retries: 1
- loadbalance: "random"
-
-protocols:
- "grpc":
- name: "grpc"
- port: 20000
-
-
-protocol_conf:
- grpc:
- session_number: 700
- session_timeout: "20s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_rq_size: 1024
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024
- session_name: "server"
diff --git a/general/grpc/go-server/profiles/release/log.yml b/general/grpc/go-server/profiles/release/log.yml
deleted file mode 100644
index e0514be..0000000
--- a/general/grpc/go-server/profiles/release/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "warn"
-development: true
-disableCaller: true
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/grpc/go-server/profiles/release/server.yml b/general/grpc/go-server/profiles/release/server.yml
deleted file mode 100644
index 214aa14..0000000
--- a/general/grpc/go-server/profiles/release/server.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-# dubbo server yaml configure file
-application:
- organization : "ikurento.com"
- name : "BDTService"
- module : "dubbogo say-hello client"
- version : "0.0.1"
- owner : "ZX"
- environment : "dev"
-
-registries :
- "demoZk":
- protocol: "zookeeper"
- timeout : "3s"
- address: "127.0.0.1:2181"
-
-services:
- "GrpcGreeterImpl":
- # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
- registry: "demoZk"
- protocol : "grpc"
- # 相当于dubbo.xml中的interface
- interface : "io.grpc.examples.helloworld.GreeterGrpc$IGreeter"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
- methods:
- - name: "SayHello"
- retries: 1
- loadbalance: "random"
-
-protocols:
- "grpc":
- name: "grpc"
- port: 20000
-
-
-protocol_conf:
- grpc:
- session_number: 700
- session_timeout: "20s"
- getty_session_param:
- compress_encoding: false
- tcp_no_delay: true
- tcp_keep_alive: true
- keep_alive_period: "120s"
- tcp_r_buf_size: 262144
- tcp_w_buf_size: 65536
- pkg_rq_size: 1024
- pkg_wq_size: 512
- tcp_read_timeout: "1s"
- tcp_write_timeout: "5s"
- wait_timeout: "1s"
- max_msg_len: 1024
- session_name: "server"
diff --git a/general/grpc/go-server/profiles/test/log.yml b/general/grpc/go-server/profiles/test/log.yml
deleted file mode 100644
index baee0b7..0000000
--- a/general/grpc/go-server/profiles/test/log.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-level: "info"
-development: false
-disableCaller: false
-disableStacktrace: true
-sampling:
-encoding: "console"
-
-# encoder
-encoderConfig:
- messageKey: "message"
- levelKey: "level"
- timeKey: "time"
- nameKey: "logger"
- callerKey: "caller"
- stacktraceKey: "stacktrace"
- lineEnding: ""
- levelEncoder: "capitalColor"
- timeEncoder: "iso8601"
- durationEncoder: "seconds"
- callerEncoder: "short"
- nameEncoder: ""
-
-outputPaths:
- - "stderr"
-errorOutputPaths:
- - "stderr"
-initialFields:
diff --git a/general/grpc/go-client/app/version.go b/general/grpc/go-server/tests/integration/greeter_test.go
similarity index 64%
rename from general/grpc/go-client/app/version.go
rename to general/grpc/go-server/tests/integration/greeter_test.go
index ae51f45..a18a3b5 100644
--- a/general/grpc/go-client/app/version.go
+++ b/general/grpc/go-server/tests/integration/greeter_test.go
@@ -1,3 +1,5 @@
+// +build integration
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +17,22 @@
* limitations under the License.
*/
-package main
+package integration
-var (
- Version = "2.7.5"
+import (
+ "context"
+ "github.com/apache/dubbo-samples/golang/general/grpc/protobuf"
+ "github.com/stretchr/testify/assert"
+ "testing"
)
+
+func TestGreeter(t *testing.T) {
+ reply := &protobuf.HelloReply{}
+ req := &protobuf.HelloRequest{
+ Name: "xujianhai",
+ }
+
+ err := grpcGreeterImpl.SayHello(context.TODO(), req, reply)
+ assert.Nil(t, err)
+ assert.Equal(t, "this is message from reply", reply.Message)
+}
diff --git a/general/grpc/go-server/app/server.go b/general/grpc/go-server/tests/integration/main_test.go
similarity index 59%
rename from general/grpc/go-server/app/server.go
rename to general/grpc/go-server/tests/integration/main_test.go
index 2f2d88d..c6a8910 100644
--- a/general/grpc/go-server/app/server.go
+++ b/general/grpc/go-server/tests/integration/main_test.go
@@ -1,3 +1,5 @@
+// +build integration
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,61 +17,48 @@
* limitations under the License.
*/
-package main
+package integration
import (
- "fmt"
- "os"
- "os/signal"
- "syscall"
- "time"
-)
+ "context"
+ "github.com/apache/dubbo-samples/golang/general/grpc/protobuf"
+ "google.golang.org/grpc"
-import (
_ "github.com/apache/dubbo-go/cluster/cluster_impl"
_ "github.com/apache/dubbo-go/cluster/loadbalance"
- "github.com/apache/dubbo-go/common/logger"
_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
_ "github.com/apache/dubbo-go/filter/filter_impl"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
_ "github.com/apache/dubbo-go/protocol/grpc"
_ "github.com/apache/dubbo-go/registry/protocol"
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout = int(3 * time.Second)
+import (
+ "os"
+ "testing"
+ "time"
)
-// they are necessary:
-// export CONF_PROVIDER_FILE_PATH="xxx"
-// export APP_LOG_CONF_FILE="xxx"
-func main() {
+var grpcGreeterImpl = new(GrpcGreeterImpl)
+func TestMain(m *testing.M) {
+ config.SetConsumerService(grpcGreeterImpl)
config.Load()
+ time.Sleep(3 * time.Second)
- initSignal()
+ os.Exit(m.Run())
}
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- time.AfterFunc(time.Duration(survivalTimeout), func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
+type GrpcGreeterImpl struct {
+ SayHello func(ctx context.Context, in *protobuf.HelloRequest, out *protobuf.HelloReply) error
+}
+
+func (u *GrpcGreeterImpl) Reference() string {
+ return "GrpcGreeterImpl"
+}
- // The program exits normally or timeout forcibly exits.
- fmt.Println("provider app exit now...")
- return
- }
- }
+func (u *GrpcGreeterImpl) GetDubboStub(cc *grpc.ClientConn) protobuf.GreeterClient {
+ return protobuf.NewGreeterClient(cc)
}
diff --git a/general/grpc/java-client/build.sh b/general/grpc/java-client/build.sh
deleted file mode 100644
index c869acf..0000000
--- a/general/grpc/java-client/build.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# rm src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/dubbo-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-# cp src/main/resources/META-INF/spring/jsonrpc-protocol.consumer.xml src/main/resources/META-INF/spring/dubbo.consumer.xml
-mvn clean package -Dmaven.test.skip
diff --git a/general/grpc/java-client/pom.xml b/general/grpc/java-client/pom.xml
deleted file mode 100644
index 687fac4..0000000
--- a/general/grpc/java-client/pom.xml
+++ /dev/null
@@ -1,247 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-client</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo consumer module of dubbo project</description>
-
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
-
- <dubbo-version>2.7.5</dubbo-version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.6</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>28.1-jre</version>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.20.0-GA</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.5.Final</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- </dependency>
- <dependency>
- <groupId>com.netflix.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>1.1.16</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.xmemcached</groupId>
- <artifactId>xmemcached</artifactId>
- <version>1.3.6</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>1.0.0.GA</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty-shaded</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-recipes</artifactId>
- <version>4.2.0</version>
- </dependency>
- </dependencies>
-
-<repositories>
- <repository>
- <id>apache.snapshots.https</id>
- <name>Apache Development Snapshot Repository</name>
- <url>https://repository.apache.org/content/repositories/snapshots</url>
- <layout>default</layout>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>daily</updatePolicy>
- </snapshots>
- </repository>
- <repository>
- <id>sonatype-nexus-snapshots</id>
- <name>Sonatype Nexus Snapshots</name>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>daily</updatePolicy>
- </snapshots>
- </repository>
-</repositories>
-
-
-
- <build>
- <extensions>
- <extension>
- <groupId>kr.motd.maven</groupId>
- <artifactId>os-maven-plugin</artifactId>
- <version>1.6.1</version>
- </extension>
- </extensions>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- <version>0.5.1</version>
- <configuration>
- <protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
- <pluginId>dubbo-grpc-java</pluginId>
- <pluginArtifact>org.apache.dubbo:protoc-gen-dubbo-java:1.19.0-SNAPSHOT:exe:${os.detected.classifier}</pluginArtifact>
- <outputDirectory>build/generated/source/proto/main/java</outputDirectory>
- <clearOutputDirectory>false</clearOutputDirectory>
- <pluginParameter>grpc</pluginParameter>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>compile-custom</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>package</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
- <includes>META-INF/assembly/**</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/general/grpc/java-client/src/main/assembly/assembly.xml b/general/grpc/java-client/src/main/assembly/assembly.xml
deleted file mode 100644
index 40c34d8..0000000
--- a/general/grpc/java-client/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/dubbo/META-INF/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- <fileSet>
- <directory>src/main/assembly/conf</directory>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/general/grpc/java-client/src/main/assembly/conf/dubbo.properties b/general/grpc/java-client/src/main/assembly/conf/dubbo.properties
deleted file mode 100644
index 1ac304c..0000000
--- a/general/grpc/java-client/src/main/assembly/conf/dubbo.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-### dubbo注册中心配置 ###
-dubbo.container = log4j,spring
-dubbo.application.name = user-info-client
-dubbo.application.owner = AlexStocks
-dubbo.application.environment = product
-dubbo.registry.address = zookeeper://127.0.0.1:2181
-dubbo.monitor.protocol = zookeeper
-dubbo.consumer.timeout = 10000
-dubbo.provider.timeout = 10000
-dubbo.protocol.name = grpc
-dubbo.application.qos.enable = false
-dubbo.log4j.file = logs/client.log
-dubbo.log4j.level = WARN
diff --git a/general/grpc/java-client/src/main/assembly/conf/log4j.properties b/general/grpc/java-client/src/main/assembly/conf/log4j.properties
deleted file mode 100644
index 06bcb34..0000000
--- a/general/grpc/java-client/src/main/assembly/conf/log4j.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
diff --git a/general/grpc/java-client/src/main/java/com/ikurento/user/Consumer.java b/general/grpc/java-client/src/main/java/com/ikurento/user/Consumer.java
deleted file mode 100644
index 622f213..0000000
--- a/general/grpc/java-client/src/main/java/com/ikurento/user/Consumer.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.ikurento.user;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.concurrent.CountDownLatch;
-
-import io.grpc.stub.StreamObserver;
-
-
-public class Consumer {
- // Define a private variable (Required in Spring)
- private UserProviderGrpc.IUserProvider userProvider;
-
- // Spring DI (Required in Spring)
- public void setUserProvider(UserProviderGrpc.IUserProvider u) {
- this.userProvider = u;
- }
-
- // Start the entry function for consumer (Specified in the configuration file)
- public void start() throws Exception {
- System.out.println("\n\ntest");
- testGetUser();
- System.out.println("\n\ntestList");
- testGetUserList();
- System.out.println("\n\ntestErr");
- testGetErr();
- System.out.println("\n\ntestStream");
- testGetUserByStream();
- }
-
- private void testGetUser() throws Exception {
- try {
- UserId userId = UserId.newBuilder().setId("A003").build();
- User user1 = userProvider.getUser(userId);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void testGetUserList() throws Exception {
- try {
- UserIdList userIdList = UserIdList.newBuilder().addId("A003").addId("A002").build();
- UserList userList = userProvider.getUserList(userIdList);
- for (User user : userList.getUserList()) {
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void testGetErr() throws Exception {
- try {
- UserId userId = UserId.newBuilder().setId("A003").build();
- userProvider.getErr(userId);
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private void testGetUserByStream() {
- try {
- UserId userId = UserId.newBuilder().setId("A001").build();
- userProvider.getUserByStream(userId, new StreamObserver<User>() {
- @Override
- public void onNext(User user) {
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, Id:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
-
- @Override
- public void onError(Throwable t) {
- t.printStackTrace();
- }
-
- @Override
- public void onCompleted() {
- System.out.println("Done");
- }
- });
-
- } catch (Exception e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- }
-}
diff --git a/general/grpc/java-client/src/main/proto/UserService.proto b/general/grpc/java-client/src/main/proto/UserService.proto
deleted file mode 100644
index b187f23..0000000
--- a/general/grpc/java-client/src/main/proto/UserService.proto
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The gRPC Authors
-//
-// Licensed 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.
-syntax = "proto3";
-import public "google/protobuf/timestamp.proto";
-
-option java_multiple_files = true;
-option java_package = "com.ikurento.user";
-option java_outer_classname = "UserProviderProto";
-option objc_class_prefix = "UP";
-
-package helloworld;
-
-// The UserProvider service definition.
-service UserProvider {
- rpc getUser (UserId) returns (User) {}
- rpc getUserList (UserIdList) returns (UserList) {}
- rpc getErr(UserId) returns (User) {}
- rpc getUserByStream(UserId) returns (stream User){}
-}
-
-// The request message containing the user's information.
-message User {
- string id = 1;
- string name = 2;
- int32 age = 3;
- google.protobuf.Timestamp time = 4;
- Gender sex = 5;
-}
-
-enum Gender{
- MAN = 0;
- WOMAN = 1;
-}
-
-message UserId{
- string id = 1;
-}
-
-message UserIdList{
- repeated string id = 1;
-}
-
-message UserList{
- repeated User user = 1;
-}
diff --git a/general/grpc/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/general/grpc/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
deleted file mode 100644
index c2732bc..0000000
--- a/general/grpc/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
-
- <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
- <dubbo:application name="user-info-client" />
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" />
- <!-- dubbo.registry.address from dubbo.properties -->
- <!-- dubbo:registry address="${dubbo.registry.address}" / -->
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="grpc" name="grpc" />
-
- <!-- 声明需要使用的服务接口 -->
- <dubbo:reference id="userProvider" protocol="grpc" interface="com.ikurento.user.UserProviderGrpc$IUserProvider">
- <!-- dubbo:reference id="userProvider" protocol="dubbo" interface="com.ikurento.user.UserProvider">
- <dubbo:parameter key="heartbeat" value="10000"/ -->
- </dubbo:reference>
-<!-- <dubbo:reference id="userProvider1" protocol="jsonrpc" version="2.0" interface="com.ikurento.user.UserProvider">-->
-<!-- </dubbo:reference>-->
-<!-- <dubbo:reference id="userProvider2" protocol="jsonrpc" version="2.0" group="as" interface="com.ikurento.user.UserProvider">-->
-<!-- </dubbo:reference>-->
-
-</beans>
diff --git a/general/grpc/java-client/src/main/resources/META-INF/spring/service.xml b/general/grpc/java-client/src/main/resources/META-INF/spring/service.xml
deleted file mode 100644
index 1e3c8da..0000000
--- a/general/grpc/java-client/src/main/resources/META-INF/spring/service.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <bean class="com.ikurento.user.Consumer" init-method="start">
- <!-- 声明这个类 要使用的服务名-->
- <property name="userProvider" ref="userProvider" />
- </bean>
-
- <!-- App config -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <list>
- <value>classpath:dubbo.properties</value>
- </list>
- </property>
- </bean>
-
-</beans>
diff --git a/general/grpc/java-client/src/main/resources/log4j.properties b/general/grpc/java-client/src/main/resources/log4j.properties
deleted file mode 100644
index 06bcb34..0000000
--- a/general/grpc/java-client/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
diff --git a/general/grpc/java-server/build.sh b/general/grpc/java-server/build.sh
deleted file mode 100644
index 7b5755b..0000000
--- a/general/grpc/java-server/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# mvn dependency:sources
-mvn clean package -Dmaven.test.skip
-# mvn -X clean compile package -DskipTests=true
diff --git a/general/grpc/java-server/pom.xml b/general/grpc/java-server/pom.xml
deleted file mode 100644
index 2a9288a..0000000
--- a/general/grpc/java-server/pom.xml
+++ /dev/null
@@ -1,225 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>com.ikurento</groupId>
- <artifactId>user-info-server</artifactId>
- <packaging>jar</packaging>
- <version>0.2.0</version>
- <description>The demo provider module of dubbo project</description>
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
-
- <dubbo-version>2.7.5</dubbo-version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-recipes</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>org.apache.zookeeper</artifactId>
- <groupId>zookeeper</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.14</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty-shaded</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- <version>1.19.0</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-api</artifactId>
- <version>1.24.1</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>apache.snapshots.https</id>
- <name>Apache Development Snapshot Repository</name>
- <url>https://repository.apache.org/content/repositories/snapshots</url>
- <layout>default</layout>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>daily</updatePolicy>
- </snapshots>
- </repository>
- <repository>
- <id>sonatype-nexus-snapshots</id>
- <name>Sonatype Nexus Snapshots</name>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>daily</updatePolicy>
- </snapshots>
- </repository>
-
- </repositories>
-
- <build>
- <extensions>
- <extension>
- <groupId>kr.motd.maven</groupId>
- <artifactId>os-maven-plugin</artifactId>
- <version>1.6.1</version>
- </extension>
- </extensions>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- <version>0.5.1</version>
- <configuration>
- <protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
- <pluginId>dubbo-grpc-java</pluginId>
- <pluginArtifact>org.apache.dubbo:protoc-gen-dubbo-java:1.19.0-SNAPSHOT:exe:${os.detected.classifier}</pluginArtifact>
- <outputDirectory>build/generated/source/proto/main/java</outputDirectory>
- <clearOutputDirectory>false</clearOutputDirectory>
- <pluginParameter>grpc</pluginParameter>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>compile-custom</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>build/generated/source/proto/main/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
-
-
-</project>
-
-
diff --git a/general/grpc/java-server/script/debug.sh b/general/grpc/java-server/script/debug.sh
deleted file mode 100644
index 1038cd7..0000000
--- a/general/grpc/java-server/script/debug.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-#
-# 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.
-
-# jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/*:/Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/ com.alibaba.dubbo.container.Main
-jdb -classpath /Users/alex/tmp/us/conf:/Users/alex/tmp/us/lib/* -sourcepath /Users/alex/test/java/dubbo/2.5.4/dubbo-remoting/dubbo-remoting-api/src/main/java/:/Users/alex/tmp/java-server/src/main/java com.alibaba.dubbo.container.Main
-# jdb stop at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec:76
-# run
-
diff --git a/general/grpc/java-server/src/main/assembly/assembly.xml b/general/grpc/java-server/src/main/assembly/assembly.xml
deleted file mode 100644
index 196cb60..0000000
--- a/general/grpc/java-server/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<assembly>
- <id>assembly</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory>src/main/assembly/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- <fileSet>
- <directory>src/main/assembly/conf</directory>
- <includes>
- <include>dubbo.properties</include>
- <include>log4j.*</include>
- </includes>
- <outputDirectory>conf</outputDirectory>
- <fileMode>0644</fileMode>
- <directoryMode>0755</directoryMode>
- </fileSet>
- </fileSets>
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- </dependencySet>
- </dependencySets>
-</assembly>
\ No newline at end of file
diff --git a/general/grpc/java-server/src/main/assembly/bin/start.bat b/general/grpc/java-server/src/main/assembly/bin/start.bat
deleted file mode 100644
index 1d274cb..0000000
--- a/general/grpc/java-server/src/main/assembly/bin/start.bat
+++ /dev/null
@@ -1,44 +0,0 @@
-@echo off & setlocal enabledelayedexpansion
-
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements. See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License. You may obtain a copy of the License at
-REM
-REM http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-
-set LIB_JARS=""
-set VM_ARGS_PERM_SIZE="MaxPermSize"
-set VM_ARGS_METASPACE_SIZE="MaxMetaspaceSize"
-set JAVA_8_VERSION="180"
-cd ..\lib
-for %%i in (*) do set LIB_JARS=!LIB_JARS!;..\lib\%%i
-cd ..\bin
-
-@REM set jvm args by different java version
-for /f tokens^=2-4^ delims^=.-_+^" %%j in ('java -fullversion 2^>^&1') do set "JAVA_VERSION=%%j%%k%%l"
-set VM_ARGS=%VM_ARGS_PERM_SIZE%
-if "%JAVA_VERSION%" GEQ %JAVA_8_VERSION% set VM_ARGS=%VM_ARGS_METASPACE_SIZE%
-if ""%1"" == ""debug"" goto debug
-if ""%1"" == ""jmx"" goto jmx
-
-java -Xms64m -Xmx1024m -XX:%VM_ARGS%=64M -classpath ..\conf;%LIB_JARS% com.ikurento.user.Provider
-goto end
-
-:debug
-java -Xms64m -Xmx1024m -XX:%VM_ARGS%=64M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -classpath ..\conf;%LIB_JARS% org.apache.dubbo.container.Main
-goto end
-
-:jmx
-java -Xms64m -Xmx1024m -XX:%VM_ARGS%=64M -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -classpath ..\conf;%LIB_JARS% org.apache.dubbo.container.Main
-
-:end
-pause
\ No newline at end of file
diff --git a/general/grpc/java-server/src/main/assembly/bin/start.sh b/general/grpc/java-server/src/main/assembly/bin/start.sh
deleted file mode 100644
index 6343ea2..0000000
--- a/general/grpc/java-server/src/main/assembly/bin/start.sh
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-cd `dirname $0`
-BIN_DIR=`pwd`
-cd ..
-DEPLOY_DIR=`pwd`
-CONF_DIR=$DEPLOY_DIR/conf
-
-SERVER_NAME=`sed '/dubbo.application.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
-SERVER_PROTOCOL=`sed '/dubbo.protocol.name/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
-SERVER_HOST=`sed '/dubbo.protocol.host/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
-SERVER_PORT=`sed '/dubbo.protocol.port/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
-LOGS_FILE=`sed '/dubbo.log4j.file/!d;s/.*=//' conf/dubbo.properties | tr -d '\r'`
-VM_ARGS_PERM_SIZE='PermSize'
-VM_ARGS_METASPACE_SIZE='MetaspaceSize'
-JAVA_8_VERSION="180"
-
-if [ -z "$SERVER_HOST" ]; then
- SERVER_HOST='127.0.0.1'
-fi
-
-if [ -z "$SERVER_NAME" ]; then
- SERVER_NAME=`hostname`
-fi
-
-PIDS=`ps -ef | grep java | grep -v grep | grep "$CONF_DIR" |awk '{print $2}'`
-if [ -n "$PIDS" ]; then
- echo "ERROR: The $SERVER_NAME already started!"
- echo "PID: $PIDS"
- exit 1
-fi
-
-if [ -n "$SERVER_PORT" ]; then
- SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
- if [ $SERVER_PORT_COUNT -gt 0 ]; then
- echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
- exit 1
- fi
-fi
-
-LOGS_DIR=""
-if [ -n "$LOGS_FILE" ]; then
- LOGS_DIR=`dirname $LOGS_FILE`
-else
- LOGS_DIR=$DEPLOY_DIR/logs
-fi
-if [ ! -d $LOGS_DIR ]; then
- mkdir $LOGS_DIR
-fi
-STDOUT_FILE=$LOGS_DIR/stdout.log
-
-LIB_DIR=$DEPLOY_DIR/lib
-LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
-
-JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
-JAVA_DEBUG_OPTS=""
-if [ "$1" = "debug" ]; then
- JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
-fi
-JAVA_JMX_OPTS=""
-if [ "$1" = "jmx" ]; then
- JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
-fi
-JAVA_MEM_OPTS=""
-# set jvm args by different java version
-JAVA_VERSION=`java -fullversion 2>&1 | awk -F[\"\.] '{print $2$3$4}' |awk -F"_" '{print $1}'`
-VM_ARGS=${VM_ARGS_PERM_SIZE}
-# if you use dubbo in java 9
-TEMP_VERSION=$(echo ${JAVA_VERSION} | grep "+")
-if [[ "$TEMP_VERSION" != "" ]]; then
- JAVA_VERSION=$(echo ${JAVA_VERSION} | awk -F"+" '{print $1}')
-fi
-# compare java version
-if [ "${JAVA_VERSION}" -ge ${JAVA_8_VERSION} ]; then
- VM_ARGS=${VM_ARGS_METASPACE_SIZE}
-fi
-
-BITS=`java -version 2>&1 | grep -i 64-bit`
-if [ -n "$BITS" ]; then
- JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn256m -XX:${VM_ARGS}=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
-else
- JAVA_MEM_OPTS=" -server -Xms1g -Xmx1g -XX:${VM_ARGS}=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
-fi
-
-echo -e "Starting the $SERVER_NAME ...\n"
-echo -e "press any key to exit\n"
-java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS com.ikurento.user.Provider > $STDOUT_FILE 2>&1
-
-COUNT=0
-while [ $COUNT -lt 1 ]; do
- echo -e ".\c"
- sleep 1
- if [ -n "$SERVER_PORT" ]; then
- if [ "$SERVER_PROTOCOL" == "dubbo" ]; then
- COUNT=`(sleep 1; echo -e '\n'; sleep 1; echo status; sleep 1)| telnet $SERVER_HOST $SERVER_PORT | grep -c OK`
- else
- COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
- fi
- else
- COUNT=`ps -ef | grep java | grep -v grep | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
- fi
- if [ $COUNT -gt 0 ]; then
- break
- fi
-done
-
-echo "OK!"
-PIDS=`ps -ef | grep java | grep -v grep | grep "$DEPLOY_DIR" | awk '{print $2}'`
-echo "PID: $PIDS"
-echo "STDOUT: $STDOUT_FILE"
diff --git a/general/grpc/java-server/src/main/assembly/conf/dubbo.properties b/general/grpc/java-server/src/main/assembly/conf/dubbo.properties
deleted file mode 100644
index 83d7e07..0000000
--- a/general/grpc/java-server/src/main/assembly/conf/dubbo.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-; ### dubbo注册中心配置 ##
-; dubbo.container = log4j,spring
-; dubbo.application.name = user-info-server
-; dubbo.application.environment = product
-; dubbo.application.owner = AlexStocks
-; dubbo.registry.address = 127.0.0.1:2181
-; dubbo.registry.protocol = zookeeper
-; dubbo.consumer.timeout = 10000
-; dubbo.provider.timeout = 10000
-; dubbo.protocol.name = jsonrpc
-; dubbo.protocol.port = 10000
-;
-; dubbo.log4j.file = logs/dubbo.log
-; dubbo.log4j.level = INFO
diff --git a/general/grpc/java-server/src/main/assembly/conf/log4j.properties b/general/grpc/java-server/src/main/assembly/conf/log4j.properties
deleted file mode 100644
index 806e33d..0000000
--- a/general/grpc/java-server/src/main/assembly/conf/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
diff --git a/general/grpc/java-server/src/main/java/com/ikurento/user/Provider.java b/general/grpc/java-server/src/main/java/com/ikurento/user/Provider.java
deleted file mode 100644
index dea1c34..0000000
--- a/general/grpc/java-server/src/main/java/com/ikurento/user/Provider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.ikurento.user;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class Provider {
-
- /**
- * To get ipv6 address to work, add
- * System.setProperty("java.net.preferIPv6Addresses", "true");
- * before running your application.
- */
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.provider.xml"});
- context.start();
- System.in.read(); // press any key to exit
- }
-}
diff --git a/general/grpc/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/general/grpc/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
deleted file mode 100644
index a81a4a8..0000000
--- a/general/grpc/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.ikurento.user;
-
-import com.google.protobuf.ProtocolStringList;
-import com.google.protobuf.Timestamp;
-import io.grpc.Status;
-import io.grpc.stub.StreamObserver;
-
-
-public class UserProviderImpl extends UserProviderGrpc.UserProviderImplBase {
-
- @Override
- public void getUser(UserId request, io.grpc.stub.StreamObserver<User> responseObserver) {
- String id = request.getId();
- User user = User.newBuilder().setId(id)
- .setTime(Timestamp.getDefaultInstance())
- .setAge(11)
- .setName("Hello")
- .setId(id)
- .build();
- responseObserver.onNext(user);
- responseObserver.onCompleted();
- }
-
- @Override
- public void getUserList(UserIdList request, StreamObserver<UserList> responseObserver){
- ProtocolStringList protocolStringList = request.getIdList();
- UserList.Builder userListBuilder = UserList.newBuilder();
- for (String id : protocolStringList) {
- User user = User.newBuilder().setId(id)
- .setTime(Timestamp.getDefaultInstance())
- .setAge(11)
- .setName("Hello")
- .setId(id)
- .build();
- userListBuilder.addUser(user);
- }
- responseObserver.onNext(userListBuilder.build());
- responseObserver.onCompleted();
- }
-
- @Override
- public void getUserByStream(UserId request, StreamObserver<User> responseObserver){
- String id = request.getId();
- User user1 = User.newBuilder().setId(id)
- .setTime(Timestamp.getDefaultInstance())
- .setAge(11)
- .setName("Hello 1")
- .setId(id)
- .build();
- responseObserver.onNext(user1);
- User user2 = User.newBuilder().setId(id)
- .setTime(Timestamp.getDefaultInstance())
- .setAge(12)
- .setName("Hello 2")
- .setId(id)
- .build();
- responseObserver.onNext(user2);
- responseObserver.onCompleted();
- }
-
-
- @Override
- public void getErr(UserId request, StreamObserver<User> responseObserver){
- try{
- throw new Exception("test error");
- }catch(Exception ex){
- responseObserver.onError(Status.INTERNAL.withCause(ex).asException());
- }
- }
-}
diff --git a/general/grpc/java-server/src/main/proto/UserService.proto b/general/grpc/java-server/src/main/proto/UserService.proto
deleted file mode 100644
index b187f23..0000000
--- a/general/grpc/java-server/src/main/proto/UserService.proto
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The gRPC Authors
-//
-// Licensed 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.
-syntax = "proto3";
-import public "google/protobuf/timestamp.proto";
-
-option java_multiple_files = true;
-option java_package = "com.ikurento.user";
-option java_outer_classname = "UserProviderProto";
-option objc_class_prefix = "UP";
-
-package helloworld;
-
-// The UserProvider service definition.
-service UserProvider {
- rpc getUser (UserId) returns (User) {}
- rpc getUserList (UserIdList) returns (UserList) {}
- rpc getErr(UserId) returns (User) {}
- rpc getUserByStream(UserId) returns (stream User){}
-}
-
-// The request message containing the user's information.
-message User {
- string id = 1;
- string name = 2;
- int32 age = 3;
- google.protobuf.Timestamp time = 4;
- Gender sex = 5;
-}
-
-enum Gender{
- MAN = 0;
- WOMAN = 1;
-}
-
-message UserId{
- string id = 1;
-}
-
-message UserIdList{
- repeated string id = 1;
-}
-
-message UserList{
- repeated User user = 1;
-}
diff --git a/general/grpc/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/general/grpc/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
deleted file mode 100644
index 136ea8d..0000000
--- a/general/grpc/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <!-- 应用名 -->
- <dubbo:application name="user-info-server"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="ikurento" address="zookeeper://127.0.0.1:2181" />
-<!-- <dubbo:registry id="ikurento2" address="zookeeper://127.0.0.1:2181" />-->
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <!-- dubbo:protocol host="127.0.0.1" / -->
- <dubbo:protocol id="grpc" name="grpc" host="127.0.0.1" port="20010" />
-<!-- <dubbo:protocol id="jsonrpc" name="jsonrpc" host="127.0.0.1" port="10010" />-->
- <!-- 声明需要暴露的服务接口 -->
- <dubbo:service registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProviderGrpc$IUserProvider" ref="demoService"/>
-<!-- <dubbo:service registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="otherService" version="2.0"/>-->
-<!-- <dubbo:service registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="otherService" group="as" version="2.0"/>-->
-
- <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
-<!-- <bean id="otherService" class="com.ikurento.user.UserProviderAnotherImpl"/>-->
-
-</beans>
diff --git a/general/grpc/java-server/src/main/resources/log4j.properties b/general/grpc/java-server/src/main/resources/log4j.properties
deleted file mode 100644
index 806e33d..0000000
--- a/general/grpc/java-server/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
diff --git a/general/grpc/go-server/app/helloworld.pb.go b/general/grpc/protobuf/helloworld.pb.go
similarity index 81%
rename from general/grpc/go-server/app/helloworld.pb.go
rename to general/grpc/protobuf/helloworld.pb.go
index 75e18b9..521fd6a 100644
--- a/general/grpc/go-server/app/helloworld.pb.go
+++ b/general/grpc/protobuf/helloworld.pb.go
@@ -1,17 +1,16 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: helloworld.proto
-package main
+package protobuf
import (
- "context"
- "fmt"
- "math"
-
- "github.com/golang/protobuf/proto"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
+ context "context"
+ fmt "fmt"
+ proto "github.com/golang/protobuf/proto"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+ math "math"
)
import (
@@ -112,35 +111,35 @@ func (m *HelloReply) GetMessage() string {
}
func init() {
- proto.RegisterType((*HelloRequest)(nil), "main.HelloRequest")
- proto.RegisterType((*HelloReply)(nil), "main.HelloReply")
+ proto.RegisterType((*HelloRequest)(nil), "protobuf.HelloRequest")
+ proto.RegisterType((*HelloReply)(nil), "protobuf.HelloReply")
}
func init() { proto.RegisterFile("helloworld.proto", fileDescriptor_17b8c58d586b62f2) }
var fileDescriptor_17b8c58d586b62f2 = []byte{
- // 185 bytes of a gzipped FileDescriptorProto
+ // 183 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x48, 0xcd, 0xc9,
- 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xc9, 0x4d,
- 0xcc, 0xcc, 0x53, 0x52, 0xe2, 0xe2, 0xf1, 0x00, 0xc9, 0x04, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97,
- 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81,
- 0xd9, 0x4a, 0x6a, 0x5c, 0x5c, 0x50, 0x35, 0x05, 0x39, 0x95, 0x42, 0x12, 0x5c, 0xec, 0xb9, 0xa9,
- 0xc5, 0xc5, 0x89, 0xe9, 0x30, 0x45, 0x30, 0xae, 0x91, 0x2d, 0x17, 0xbb, 0x7b, 0x51, 0x6a, 0x6a,
- 0x49, 0x6a, 0x91, 0x90, 0x11, 0x17, 0x47, 0x70, 0x62, 0x25, 0x58, 0x97, 0x90, 0x90, 0x1e, 0xc8,
- 0x26, 0x3d, 0x64, 0x6b, 0xa4, 0x04, 0x50, 0xc4, 0x0a, 0x72, 0x2a, 0x95, 0x18, 0x9c, 0xcc, 0xb8,
- 0xa4, 0x33, 0xf3, 0xf5, 0xd2, 0x8b, 0x0a, 0x92, 0xf5, 0x52, 0x2b, 0x12, 0x73, 0x0b, 0x72, 0x52,
- 0x8b, 0xf5, 0x10, 0xae, 0x76, 0xe2, 0x07, 0x2b, 0x0e, 0x07, 0xb1, 0x03, 0x40, 0x1e, 0x08, 0x60,
- 0x5c, 0xc4, 0xc4, 0xec, 0xe1, 0x13, 0x9e, 0xc4, 0x06, 0xf6, 0x8f, 0x31, 0x20, 0x00, 0x00, 0xff,
- 0xff, 0xd2, 0x16, 0x5f, 0x34, 0xe3, 0x00, 0x00, 0x00,
+ 0xc9, 0x2f, 0xcf, 0x2f, 0xca, 0x49, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53,
+ 0x49, 0xa5, 0x69, 0x4a, 0x4a, 0x5c, 0x3c, 0x1e, 0x20, 0xd9, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2,
+ 0x12, 0x21, 0x21, 0x2e, 0x96, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20,
+ 0x30, 0x5b, 0x49, 0x8d, 0x8b, 0x0b, 0xaa, 0xa6, 0x20, 0xa7, 0x52, 0x48, 0x82, 0x8b, 0x3d, 0x37,
+ 0xb5, 0xb8, 0x38, 0x31, 0x1d, 0xa6, 0x08, 0xc6, 0x35, 0x72, 0xe5, 0x62, 0x77, 0x2f, 0x4a, 0x4d,
+ 0x2d, 0x49, 0x2d, 0x12, 0xb2, 0xe2, 0xe2, 0x08, 0x4e, 0xac, 0x04, 0xeb, 0x12, 0x12, 0xd3, 0x83,
+ 0xd9, 0xa6, 0x87, 0x6c, 0x95, 0x94, 0x08, 0x86, 0x78, 0x41, 0x4e, 0xa5, 0x12, 0x83, 0x93, 0x36,
+ 0x97, 0x40, 0x7e, 0x51, 0xba, 0x5e, 0x62, 0x41, 0x62, 0x72, 0x46, 0xaa, 0x5e, 0x4a, 0x69, 0x52,
+ 0x52, 0xbe, 0x13, 0x3f, 0x58, 0x45, 0x38, 0xc8, 0x0b, 0x01, 0x20, 0x4d, 0x01, 0x8c, 0x8b, 0x98,
+ 0x98, 0x3d, 0x7c, 0xc2, 0x93, 0xd8, 0xc0, 0x66, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xde,
+ 0x1e, 0xf0, 0xa3, 0xe4, 0x00, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
-var _ grpc.ClientConn
+var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion4
+const _ = grpc.SupportPackageIsVersion6
// GreeterClient is the client API for Greeter service.
//
@@ -151,16 +150,16 @@ type GreeterClient interface {
}
type greeterClient struct {
- cc *grpc.ClientConn
+ cc grpc.ClientConnInterface
}
-func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
+func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
return &greeterClient{cc}
}
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
out := new(HelloReply)
- err := c.cc.Invoke(ctx, "/main.Greeter/SayHello", in, out, opts...)
+ err := c.cc.Invoke(ctx, "/protobuf.Greeter/SayHello", in, out, opts...)
if err != nil {
return nil, err
}
@@ -195,7 +194,7 @@ func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/main.Greeter/SayHello",
+ FullMethod: "/protobuf.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
@@ -204,7 +203,7 @@ func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(in
}
var _Greeter_serviceDesc = grpc.ServiceDesc{
- ServiceName: "main.Greeter",
+ ServiceName: "protobuf.Greeter",
HandlerType: (*GreeterServer)(nil),
Methods: []grpc.MethodDesc{
{
@@ -259,7 +258,7 @@ func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/main.Greeter/SayHello",
+ FullMethod: "/protobuf.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.GetProxyImpl().Invoke(context.Background(), invo)
@@ -270,7 +269,7 @@ func _DUBBO_Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec f
func (s *GreeterProviderBase) ServiceDesc() *grpc.ServiceDesc {
return &grpc.ServiceDesc{
- ServiceName: "main.Greeter",
+ ServiceName: "protobuf.Greeter",
HandlerType: (*GreeterServer)(nil),
Methods: []grpc.MethodDesc{
{
diff --git a/general/grpc/go-client/app/helloworld.proto b/general/grpc/protobuf/helloworld.proto
similarity index 94%
rename from general/grpc/go-client/app/helloworld.proto
rename to general/grpc/protobuf/helloworld.proto
index d68e1dd..3a440cd 100644
--- a/general/grpc/go-client/app/helloworld.proto
+++ b/general/grpc/protobuf/helloworld.proto
@@ -14,11 +14,11 @@
syntax = "proto3";
option java_multiple_files = true;
-option java_package = "io.grpc.examples.helloworld";
+option java_package = "org.apache.dubbo";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
-package main;
+package protobuf;
// The greeting service definition.
service Greeter {
diff --git a/general/grpc/protobuf/protobuf.mk b/general/grpc/protobuf/protobuf.mk
new file mode 100644
index 0000000..618c49d
--- /dev/null
+++ b/general/grpc/protobuf/protobuf.mk
@@ -0,0 +1,26 @@
+.PHONY: compile
+PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go
+PROTOC := $(shell which protoc)
+ifeq ($(PROTOC),)
+ PROTOC = must-rebuild
+endif
+
+UNAME := $(shell uname)
+
+$(PROTOC):
+ifeq ($(UNAME), Darwin)
+ brew install protobuf
+endif
+ifeq ($(UNAME), Linux)
+ sudo apt-get install protobuf-compiler
+endif
+
+$(PROTOC_GEN_GO):
+ go get -u github.com/apache/dubbo-go/protocol/grpc/protoc-gen-dubbo
+
+helloworld.pb.go: helloworld.proto | $(PROTOC_GEN_GO) $(PROTOC)
+ protoc -I . helloworld.proto --dubbo_out=plugins=grpc+dubbo:.
+
+.PHONY: compile
+compile: helloworld.pb.go
+
diff --git a/go.mod b/go.mod
index c02b0f8..f9c0c3d 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ require (
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
github.com/dubbogo/gost v1.9.2
github.com/emicklei/go-restful/v3 v3.0.0
- github.com/golang/protobuf v1.4.0
+ github.com/golang/protobuf v1.4.3
github.com/opentracing/opentracing-go v1.1.0
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
github.com/openzipkin/zipkin-go v0.2.2
@@ -15,7 +15,8 @@ require (
github.com/stretchr/testify v1.6.1
github.com/uber/jaeger-client-go v2.22.1+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
- google.golang.org/grpc v1.26.0
+ google.golang.org/grpc v1.27.0
+ google.golang.org/protobuf v1.25.0 // indirect
)
go 1.13
diff --git a/go.sum b/go.sum
index af72596..98ab38b 100644
--- a/go.sum
+++ b/go.sum
@@ -238,6 +238,7 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 h1:Ujru1hufTHVb++eG6OuNDKMxZnGIvF6o/u8q/8h2+I4=
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
+github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8=
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M=
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
@@ -312,6 +313,9 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -324,6 +328,8 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
@@ -344,6 +350,7 @@ github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEo
github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw=
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
@@ -578,6 +585,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
+github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbMEn2SZ+gT+3IUKx8BqxyQdz+BY=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -797,6 +805,7 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
+github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -1050,6 +1059,8 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgX
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1 h1:aQktFqmDE2yjveXJlVIfslDFmFnUXSqG0i6KRcJAeMc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@@ -1065,6 +1076,8 @@ google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1072,6 +1085,10 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=