Merge remote-tracking branch 'apache/master'
diff --git a/golang/.images/edit_configuratios.png b/golang/.images/edit_configuratios.png
new file mode 100644
index 0000000..b4c9235
--- /dev/null
+++ b/golang/.images/edit_configuratios.png
Binary files differ
diff --git a/golang/.images/edit_env.png b/golang/.images/edit_env.png
new file mode 100644
index 0000000..236c1bb
--- /dev/null
+++ b/golang/.images/edit_env.png
Binary files differ
diff --git a/golang/README.md b/golang/README.md
index eaa03f2..a58e353 100644
--- a/golang/README.md
+++ b/golang/README.md
@@ -7,20 +7,27 @@
* helloworld
A simplest example. It contain 'go-client', 'go-server', 'java-server' of dubbo protocol.
+
+* direct
+
+ A direct example. This feature make start of dubbo-go get easy.
+
+* async
+
+ An async example. dubbo-go supports client to call server asynchronously.
* general
A general example. It had validated zookeeper registry and different parameter lists of service.
- And it has a comprehensive testing with dubbo/jsonrpc protocol. You can refer to it to create your first complete dubbo-go project.
+ And it has a comprehensive testing with dubbo/jsonrpc/grpc/rest protocol. You can refer to it to create your first complete dubbo-go project.
* generic
- A generic reference example. It show how to use generic reference of dubbo-go.
+ A generic example. It show how to use generic feature of dubbo-go.
* configcenter
- Some examples of different config center. There are only two -- zookeeper and apollo at present.
-
+ Some examples of different config center. There are three -- zookeeper, apollo and nacos at present.
* multi_registry
@@ -28,11 +35,23 @@
* registry
- Some examples of different registry. There are kubernetes and nacos at present.
+ Some examples of different registry. There are kubernetes, nacos and etcd at present.
+
+ **Note**:
+
+ When use different registry, you need update config file, but also must import the registry package. see the etcd `README`
* filter
Some examples of different filter. Including custom_filter and tpslimit
+
+* router
+
+ Some router examples. Now, a condition router example is existing.
+
+* tracing
+
+ Some tracing examples. We have tracing support of dubbo/grpc/jsonrpc protocol at present.
## How to build and run
@@ -87,6 +106,26 @@
sh ./bin/load_user_info_client.sh start $SUFFIX
```
+## How to debug with Goland
+
+### Edit Configurations
+
+![](.images/edit_configuratios.png)
+
+### Configure `Environment Variable`
+
+1. Add `APP_LOG_CONF_FILE`. eg: `/home/xx/dubbogo-samples/helloworld/client/conf/log.yml`
+2. Add `CONF_CONSUMER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/client/conf/client.yml`
+3. Add `CONF_PROVIDER_FILE_PATH` eg: `/home/xx/dubbogo-samples/helloworld/server/conf/server.yml`
+
+![](.images/edit_env.png)
+
+### Apply & Run
+
## How to contribute
-Please make pr to https://github.com/dubbogo/dubbo-samples instead of https://github.com/apache/dubbo-samples. We will synchronize to apache/dubbo-samples regularly.
+If you want to add some samples, we hope that you can do this:
+1. Adding samples in appropriate directory. If you dont' know which directory you should put your samples into, you can get some advices from dubbo-go community.
+2. You must run the samples locally and there must be no any error.
+3. If your samples have some third party dependency, including another framework, we hope that you can provide some docs, script is better.
+4. Please make pr to https://github.com/dubbogo/dubbo-samples instead of https://github.com/apache/dubbo-samples. We will synchronize to apache/dubbo-samples regularly.
diff --git a/golang/configcenter/nacos/dubbo/go.mod b/golang/configcenter/nacos/dubbo/go.mod
deleted file mode 100644
index 417fe42..0000000
--- a/golang/configcenter/nacos/dubbo/go.mod
+++ /dev/null
@@ -1,8 +0,0 @@
-module github.com/dubbogo/dubbogo-samples
-
-require (
- github.com/apache/dubbo-go v1.0.1-0.20200301092037-08d8cb93e005
- github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac
-)
-
-go 1.13
diff --git a/golang/configcenter/nacos/dubbo/go.sum b/golang/configcenter/nacos/dubbo/go.sum
deleted file mode 100644
index e9ea7e7..0000000
--- a/golang/configcenter/nacos/dubbo/go.sum
+++ /dev/null
@@ -1,406 +0,0 @@
-cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-github.com/Azure/azure-sdk-for-go v16.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
-github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
-github.com/Azure/go-autorest v10.7.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
-github.com/Azure/go-autorest v10.15.3+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
-github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
-github.com/Jeffail/gabs v1.1.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
-github.com/Microsoft/go-winio v0.4.3/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
-github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
-github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
-github.com/SAP/go-hdb v0.12.0/go.mod h1:etBT+FAi1t5k3K3tf5vQTnosgYmhDkRi8jEnQqCnxF0=
-github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA=
-github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
-github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo=
-github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
-github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
-github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 h1:rFw4nCn9iMW+Vajsk51NtYIcwSTkXr+JGrMd36kTDJw=
-github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
-github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e h1:MSuLXx/mveDbpDNhVrcWTMeV4lbYWKcyO4rH+jAxmX0=
-github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ=
-github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
-github.com/apache/dubbo-go v1.0.1-0.20200301092037-08d8cb93e005 h1:4jV1ft7qGj65g4N7bD2qsdGYlWlKw8q6FnQ6tzfD6yQ=
-github.com/apache/dubbo-go v1.0.1-0.20200301092037-08d8cb93e005/go.mod h1:jKjRwql1YysttGXL9UtOoMaQ/alWQ/eVFKBTLq5+B/0=
-github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac h1:QKRMidg/RbdI5oaQWMb8Lxo63S+fLmsgMxsFoOCftKw=
-github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac/go.mod h1:VwEnsOMidkM1usya2uPfGpSLO9XUF//WQcWn3y+jFz8=
-github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
-github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
-github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
-github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
-github.com/asaskevich/govalidator v0.0.0-20180319081651-7d2e70ef918f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
-github.com/aws/aws-sdk-go v1.15.24/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
-github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
-github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
-github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
-github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
-github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
-github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
-github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 h1:D21IyuvjDCshj1/qq+pCNd3VZOAEI9jy6Bi131YlXgI=
-github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
-github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
-github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
-github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
-github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
-github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
-github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
-github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
-github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
-github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
-github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
-github.com/creasty/defaults v1.3.0 h1:uG+RAxYbJgOPCOdKEcec9ZJXeva7Y6mj/8egdzwmLtw=
-github.com/creasty/defaults v1.3.0/go.mod h1:CIEEvs7oIVZm30R8VxtFJs+4k201gReYyuYHJxZc68I=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/denisenkom/go-mssqldb v0.0.0-20180620032804-94c9c97e8c9f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc=
-github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
-github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
-github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU=
-github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU=
-github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
-github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
-github.com/dubbogo/getty v1.3.2 h1:l1KVSs/1CtTKbIPTrkTtBT6S9ddvmswDGoAnnl2CDpM=
-github.com/dubbogo/getty v1.3.2/go.mod h1:ANbVQ9tbpZ2b0xdR8nRrgS/oXIsZAeRxzvPSOn/7mbk=
-github.com/dubbogo/go-zookeeper v1.0.0 h1:RsYdlGwhDW+iKXM3eIIcvt34P2swLdmQfuIJxsHlGoM=
-github.com/dubbogo/go-zookeeper v1.0.0/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
-github.com/dubbogo/gost v1.5.1/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
-github.com/dubbogo/gost v1.5.2 h1:ri/03971hdpnn3QeCU+4UZgnRNGDXLDGDucR/iozZm8=
-github.com/dubbogo/gost v1.5.2/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
-github.com/duosecurity/duo_api_golang v0.0.0-20190308151101-6c680f768e74/go.mod h1:UqXY1lYT/ERa4OEAywUqdok1T4RCRdArkhic1Opuavo=
-github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
-github.com/envoyproxy/go-control-plane v0.8.0/go.mod h1:GSSbY9P1neVhdY7G4wu+IK1rk/dqhiCC/4ExuWJZVuk=
-github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
-github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
-github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
-github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
-github.com/fatih/structs v0.0.0-20180123065059-ebf56d35bba7/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
-github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
-github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
-github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
-github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
-github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
-github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
-github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
-github.com/go-sql-driver/mysql v0.0.0-20180618115901-749ddf1598b4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
-github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
-github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
-github.com/gocql/gocql v0.0.0-20180617115710-e06f8c1bcd78/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
-github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
-github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
-github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
-github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
-github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
-github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
-github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
-github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-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=
-github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
-github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
-github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
-github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
-github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
-github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
-github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4=
-github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-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/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
-github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
-github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
-github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
-github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
-github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
-github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
-github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
-github.com/hashicorp/consul v1.5.3/go.mod h1:61E2GJCPEP3oq8La7sfDdWGQ66+Zbxzw5ecOdFD7xIE=
-github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
-github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
-github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
-github.com/hashicorp/go-bexpr v0.1.0/go.mod h1:ANbpTX1oAql27TZkKVeW8p1w8NTdnyzPe/0qqPCKohU=
-github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4=
-github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
-github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
-github.com/hashicorp/go-discover v0.0.0-20190403160810-22221edb15cd/go.mod h1:ueUgD9BeIocT7QNuvxSyJyPAM9dfifBcaWmeybb67OY=
-github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
-github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
-github.com/hashicorp/go-memdb v0.0.0-20180223233045-1289e7fffe71/go.mod h1:kbfItVoBJwCfKXDXN4YoAXjxcFVZ7MRrJzyTX6H4giE=
-github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
-github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
-github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
-github.com/hashicorp/go-plugin v0.0.0-20180331002553-e8d22c780116/go.mod h1:JSqWYsict+jzcj0+xElxyrBQRPNoiWQuddnxArJ7XHQ=
-github.com/hashicorp/go-raftchunking v0.6.1/go.mod h1:cGlg3JtDy7qy6c/3Bu660Mic1JF+7lWqIwCFSb08fX0=
-github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
-github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
-github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
-github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
-github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
-github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
-github.com/hashicorp/go-version v0.0.0-20170202080759-03c5bf6be031/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
-github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
-github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
-github.com/hashicorp/hcl v0.0.0-20180906183839-65a6292f0157/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/hashicorp/hil v0.0.0-20160711231837-1e86c6b523c5/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts=
-github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
-github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
-github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
-github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
-github.com/hashicorp/memberlist v0.1.4/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
-github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69/go.mod h1:/z+jUGRBlwVpUZfjute9jWaF6/HuhjuFQuL1YXzVD1Q=
-github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
-github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
-github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
-github.com/hashicorp/vault v0.10.3/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0=
-github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20190318174639-195e0e9d07f1/go.mod h1:VJHHT2SC1tAPrfENQeBhLlb5FbZoKZM+oC/ROmEftz0=
-github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443/go.mod h1:bEpDU35nTu0ey1EXjwNwPjI9xErAsoOCmcMb9GKvyxo=
-github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
-github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
-github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
-github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4=
-github.com/jefferai/jsonx v0.0.0-20160721235117-9cc31c3135ee/go.mod h1:N0t2vlmpe8nyZB5ouIbJQPDSR+mH6oe7xHB9VZHSUzM=
-github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
-github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
-github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 h1:mGIXW/lubQ4B+3bXTLxcTMTjUNDqoF6T/HUW9LbFx9s=
-github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s=
-github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
-github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
-github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
-github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
-github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
-github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA=
-github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
-github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
-github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
-github.com/keybase/go-crypto v0.0.0-20180614160407-5114a9a81e1b/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M=
-github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
-github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 h1:0iQektZGS248WXmGIYOwRXSQhD4qn3icjMpuxwO7qlo=
-github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570/go.mod h1:BLt8L9ld7wVsvEWQbuLrUZnCMnUmLZ+CGDzKtclrTlE=
-github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f h1:sgUSP4zdTUZYZgAGGtN5Lxk92rK+JUFOwf+FT99EEI4=
-github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f/go.mod h1:UGmTpUd3rjbtfIpwAPrcfmGf/Z1HS95TATB+m57TPB8=
-github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 h1:Bvq8AziQ5jFF4BHGAEDSqwPW1NJS3XshxbRCxtjFAZc=
-github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0=
-github.com/lib/pq v0.0.0-20180523175426-90697d60dd84/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
-github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
-github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
-github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
-github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
-github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
-github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
-github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
-github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
-github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
-github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
-github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
-github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
-github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
-github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-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/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/nacos-group/nacos-sdk-go v0.0.0-20190723125407-0242d42e3dbb h1:lbmvw8r9W55w+aQgWn35W1nuleRIECMoqUrmwAOAvoI=
-github.com/nacos-group/nacos-sdk-go v0.0.0-20190723125407-0242d42e3dbb/go.mod h1:CEkSvEpoveoYjA81m4HNeYQ0sge0LFGKSEqO3JKHllo=
-github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk=
-github.com/oklog/run v0.0.0-20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
-github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
-github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
-github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
-github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
-github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
-github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
-github.com/ory/dockertest v3.3.4+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=
-github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otzZQXgoO96RTzDB/Hycg0qZcXZsWJGJRSXbmEIJ+4M=
-github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
-github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
-github.com/patrickmn/go-cache v0.0.0-20180527043350-9f6ff22cfff8/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
-github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
-github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
-github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
-github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
-github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
-github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
-github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
-github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
-github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
-github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
-github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
-github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
-github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
-github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
-github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
-github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU=
-github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
-github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
-github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
-github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
-github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
-github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
-github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
-github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
-github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
-github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
-github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
-github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
-github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945 h1:N8Bg45zpk/UcpNGnfJt2y/3lRWASHNTUET8owPYCgYI=
-github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
-github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d/go.mod h1:Cw4GTlQccdRGSEf6KiMju767x0NEHE0YIVPJSaXjlsw=
-github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
-github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
-github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
-github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
-github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-github.com/tebeka/strftime v0.1.3 h1:5HQXOqWKYRFfNyBMNVc9z5+QzuBtIXy03psIhtdJYto=
-github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
-github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8=
-github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0=
-github.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k=
-github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
-github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 h1:kF/7m/ZU+0D4Jj5eZ41Zm3IH/J8OElK1Qtd7tVKAwLk=
-github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE=
-github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
-github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
-github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
-github.com/zouyx/agollo v0.0.0-20191114083447-dde9fc9f35b8 h1:k8TV7Gz7cpWpOw/dz71fx8cCZdWoPuckHJ/wkJl+meg=
-github.com/zouyx/agollo v0.0.0-20191114083447-dde9fc9f35b8/go.mod h1:S1cAa98KMFv4Sa8SbJ6ZtvOmf0VlgH0QJ1gXI0lBfBY=
-go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
-go.etcd.io/etcd v3.3.13+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
-go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
-go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
-go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
-go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
-go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
-go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
-golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
-golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
-golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/oauth2 v0.0.0-20170807180024-9a379c6b3e95/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
-golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
-golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190508220229-2d0786266e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
-golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
-golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-google.golang.org/api v0.0.0-20180829000535-087779f1d2c9/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
-google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
-google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
-google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
-google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
-google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
-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=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
-gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
-gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
-gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk=
-gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
-gopkg.in/mgo.v2 v2.0.0-20160818020120-3f83fa500528/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
-gopkg.in/ory-am/dockertest.v3 v3.3.4/go.mod h1:s9mmoLkaGeAh97qygnNj4xWkiN7e1SKekYC6CovU+ek=
-gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
-gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
-gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
-gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
-gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
-gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
-honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
-honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
-istio.io/gogo-genproto v0.0.0-20190124151557-6d926a6e6feb/go.mod h1:eIDJ6jNk/IeJz6ODSksHl5Aiczy5JUq6vFhJWI5OtiI=
-k8s.io/api v0.0.0-20180806132203-61b11ee65332/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
-k8s.io/api v0.0.0-20190325185214-7544f9db76f6/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
-k8s.io/apimachinery v0.0.0-20180821005732-488889b0007f/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
-k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
-k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
diff --git a/golang/direct/README.md b/golang/direct/README.md
new file mode 100644
index 0000000..0ef5746
--- /dev/null
+++ b/golang/direct/README.md
@@ -0,0 +1,3 @@
+### User Direct Feature
+
+Set url of server in `client.yml/references/ServiceId/url`, and then you will enjoy the direct feature not registry.
diff --git a/golang/filter/custom_filter/dubbo/go-server/app/custom_filter.go b/golang/filter/custom_filter/dubbo/go-server/app/custom_filter.go
index 7b489e8..3d317fd 100644
--- a/golang/filter/custom_filter/dubbo/go-server/app/custom_filter.go
+++ b/golang/filter/custom_filter/dubbo/go-server/app/custom_filter.go
@@ -18,6 +18,7 @@
package main
import (
+ "context"
"sync"
)
@@ -50,16 +51,16 @@
type myCustomFilter struct{}
-func (mf myCustomFilter) Invoke(invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
+func (mf myCustomFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
// the logic put here...
// you can get many params in url. And the invocation provides more information about
url := invoker.GetUrl()
serviceKey := url.ServiceKey()
println("Here is the my custom filter. The service is invoked: %s", serviceKey)
- return invoker.Invoke(invocation)
+ return invoker.Invoke(ctx, invocation)
}
-func (mf myCustomFilter) OnResponse(result protocol.Result, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
+func (mf myCustomFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
// you can do something here with result
println("Got result!")
return result
diff --git a/golang/general/dubbo/go-client/profiles/dev/client.yml b/golang/general/dubbo/go-client/profiles/dev/client.yml
index 14ec401..f571913 100755
--- a/golang/general/dubbo/go-client/profiles/dev/client.yml
+++ b/golang/general/dubbo/go-client/profiles/dev/client.yml
@@ -81,3 +81,5 @@
wait_timeout: "1s"
max_msg_len: 1024000
session_name: "client"
+
+filter: "tracing"
diff --git a/golang/general/dubbo/go-server/profiles/dev/server.yml b/golang/general/dubbo/go-server/profiles/dev/server.yml
index 1ef9485..4a542e2 100755
--- a/golang/general/dubbo/go-server/profiles/dev/server.yml
+++ b/golang/general/dubbo/go-server/profiles/dev/server.yml
@@ -90,3 +90,5 @@
wait_timeout: "1s"
max_msg_len: 1024000
session_name: "server"
+
+filter: "tracing"
\ No newline at end of file
diff --git a/golang/general/grpc/go-client/app/helloworld.pb.go b/golang/general/grpc/go-client/app/helloworld.pb.go
index 33d47e0..61361f5 100644
--- a/golang/general/grpc/go-client/app/helloworld.pb.go
+++ b/golang/general/grpc/go-client/app/helloworld.pb.go
@@ -254,7 +254,7 @@
args = append(args, in)
invo := invocation.NewRPCInvocation("SayHello", args, nil)
if interceptor == nil {
- result := base.GetProxyImpl().Invoke(invo)
+ result := base.GetProxyImpl().Invoke(context.Background(),invo)
return result.Result(), result.Error()
}
info := &grpc.UnaryServerInfo{
@@ -262,7 +262,7 @@
FullMethod: "/main.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- result := base.GetProxyImpl().Invoke(invo)
+ result := base.GetProxyImpl().Invoke(context.Background(),invo)
return result.Result(), result.Error()
}
return interceptor(ctx, in, info, handler)
diff --git a/golang/general/grpc/go-client/profiles/test/client.yml b/golang/general/grpc/go-client/profiles/test/client.yml
index 8d93294..e0c0737 100644
--- a/golang/general/grpc/go-client/profiles/test/client.yml
+++ b/golang/general/grpc/go-client/profiles/test/client.yml
@@ -7,6 +7,10 @@
# connect timeout
connect_timeout : "3s"
+config_center:
+ protocol: "zookeeper"
+ address: "127.0.0.1:2181"
+
# application config
application:
organization : "ikurento.com"
@@ -14,7 +18,7 @@
module : "dubbogo say-hello client"
version : "0.0.1"
owner : "ZX"
- environment : "release"
+ environment : "dev"
registries :
"demoZk":
@@ -24,7 +28,6 @@
username: ""
password: ""
-
references:
"GrpcGreeterImpl":
# 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
@@ -52,7 +55,6 @@
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"
diff --git a/golang/general/grpc/go-server/app/helloworld.pb.go b/golang/general/grpc/go-server/app/helloworld.pb.go
index 33d47e0..61361f5 100644
--- a/golang/general/grpc/go-server/app/helloworld.pb.go
+++ b/golang/general/grpc/go-server/app/helloworld.pb.go
@@ -254,7 +254,7 @@
args = append(args, in)
invo := invocation.NewRPCInvocation("SayHello", args, nil)
if interceptor == nil {
- result := base.GetProxyImpl().Invoke(invo)
+ result := base.GetProxyImpl().Invoke(context.Background(),invo)
return result.Result(), result.Error()
}
info := &grpc.UnaryServerInfo{
@@ -262,7 +262,7 @@
FullMethod: "/main.Greeter/SayHello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- result := base.GetProxyImpl().Invoke(invo)
+ result := base.GetProxyImpl().Invoke(context.Background(),invo)
return result.Result(), result.Error()
}
return interceptor(ctx, in, info, handler)
diff --git a/golang/general/grpc/go-server/profiles/release/server.yml b/golang/general/grpc/go-server/profiles/release/server.yml
index 3370e8b..214aa14 100644
--- a/golang/general/grpc/go-server/profiles/release/server.yml
+++ b/golang/general/grpc/go-server/profiles/release/server.yml
@@ -1,14 +1,11 @@
# 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 : "release"
+ environment : "dev"
registries :
"demoZk":
diff --git a/golang/general/rest/go-client/app/client.go b/golang/general/rest/go-client/app/client.go
new file mode 100755
index 0000000..0b02a74
--- /dev/null
+++ b/golang/general/rest/go-client/app/client.go
@@ -0,0 +1,209 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ "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/protocol/rest"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ config.Load()
+
+ println("\n\ntest")
+ test()
+ println("\n\ntest1")
+ test1()
+ println("\n\ntest2")
+ test2()
+
+ 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
+ }
+ }
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+func test() {
+
+ println("\n\n\nstart to test rest")
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test rest - GetUser0")
+ ret, err := userProvider.GetUser0("A003", "Moorse中文", 30)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test rest - GetUsers")
+ ret1, err := userProvider.GetUsers([]interface{}{&User{ID: "A002"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test rest - GetUser3")
+ err = userProvider.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test rest illegal method")
+ err = userProvider.GetUser1(context.TODO(), []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
+
+func test1() {
+
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test rest")
+ user := &User{}
+ err := userProvider1.GetUser(context.TODO(), []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test rest - GetUser0")
+ ret, err := userProvider1.GetUser0("A003", "Moorse中文", 30)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test rest - GetUsers")
+ ret1, err := userProvider1.GetUsers([]interface{}{&User{ID: "A002"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test rest - GetUser3")
+ err = userProvider1.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test rest illegal method")
+ err = userProvider1.GetUser1(context.TODO(), []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
+
+func test2() {
+
+ println("\n\n\nstart to test rest")
+ user := &User{}
+ err := userProvider2.GetUser(context.TODO(), []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test rest - GetUser0")
+ ret, err := userProvider2.GetUser0("A003", "Moorse中文", 30)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test rest - GetUsers")
+ ret1, err := userProvider2.GetUsers([]interface{}{&User{ID: "A002"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test rest - GetUser3")
+ err = userProvider2.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test rest illegal method")
+ err = userProvider2.GetUser1(context.TODO(), []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
diff --git a/golang/general/rest/go-client/app/user.go b/golang/general/rest/go-client/app/user.go
new file mode 100755
index 0000000..dece0f6
--- /dev/null
+++ b/golang/general/rest/go-client/app/user.go
@@ -0,0 +1,97 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+var (
+ userProvider = new(UserProvider)
+ userProvider1 = new(UserProvider1)
+ userProvider2 = new(UserProvider2)
+)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ config.SetConsumerService(userProvider1)
+ config.SetConsumerService(userProvider2)
+}
+
+type User struct {
+ ID string
+ Name string
+ Age int64
+ Time int64
+ Sex string
+}
+
+func (u User) String() string {
+ return fmt.Sprintf(
+ "User{ID:%s, Name:%s, Age:%d, Time:%s, Sex:%s}",
+ u.ID, u.Name, u.Age, time.Unix(u.Time, 0).Format("2006-01-02 15:04:05.99999"), u.Sex,
+ )
+}
+
+type UserProvider struct {
+ GetUsers func(req []interface{}) ([]User, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser0 func(id string, name string, age int) (*User, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *User) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+type UserProvider1 struct {
+ GetUsers func(req []interface{}) ([]User, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser0 func(id string, name string, age int) (User, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *User) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider1) Reference() string {
+ return "UserProvider1"
+}
+
+type UserProvider2 struct {
+ GetUsers func(req []interface{}) ([]User, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser0 func(id string, name string, age int) (User, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *User) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *User) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider2) Reference() string {
+ return "UserProvider2"
+}
diff --git a/golang/general/rest/go-client/app/version.go b/golang/general/rest/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/general/rest/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/general/rest/go-client/assembly/bin/load.sh b/golang/general/rest/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/general/rest/go-client/assembly/common/app.properties b/golang/general/rest/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/general/rest/go-client/assembly/common/build.sh b/golang/general/rest/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d1f7136
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/general/rest/go-client/assembly/linux/dev.sh b/golang/general/rest/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-client/assembly/linux/release.sh b/golang/general/rest/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/general/rest/go-client/assembly/linux/test.sh b/golang/general/rest/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/general/rest/go-client/assembly/mac/dev.sh b/golang/general/rest/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-client/assembly/mac/release.sh b/golang/general/rest/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/general/rest/go-client/assembly/mac/test.sh b/golang/general/rest/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/general/rest/go-client/assembly/windows/dev.sh b/golang/general/rest/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/general/rest/go-client/assembly/windows/release.sh b/golang/general/rest/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/general/rest/go-client/assembly/windows/test.sh b/golang/general/rest/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/general/rest/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/general/rest/go-client/profiles/dev/client.yml b/golang/general/rest/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..70f229b
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/dev/client.yml
@@ -0,0 +1,113 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
diff --git a/golang/general/rest/go-client/profiles/dev/log.yml b/golang/general/rest/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..3ed242d
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/general/rest/go-client/profiles/release/client.yml b/golang/general/rest/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..72c33f3
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/release/client.yml
@@ -0,0 +1,119 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
diff --git a/golang/general/rest/go-client/profiles/release/log.yml b/golang/general/rest/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..d860624
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/general/rest/go-client/profiles/test/client.yml b/golang/general/rest/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..4367a65
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/test/client.yml
@@ -0,0 +1,112 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
diff --git a/golang/general/rest/go-client/profiles/test/log.yml b/golang/general/rest/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..f93d3c7
--- /dev/null
+++ b/golang/general/rest/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/general/rest/go-server/app/server.go b/golang/general/rest/go-server/app/server.go
new file mode 100755
index 0000000..b98c677
--- /dev/null
+++ b/golang/general/rest/go-server/app/server.go
@@ -0,0 +1,86 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ "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/protocol/rest"
+ "github.com/apache/dubbo-go/protocol/rest/server/server_impl"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ "github.com/emicklei/go-restful/v3"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ server_impl.AddGoRestfulServerFilter(func(request *restful.Request, response *restful.Response, chain *restful.FilterChain) {
+ println(request.SelectedRoutePath())
+ chain.ProcessFilter(request, response)
+ })
+ server_impl.AddGoRestfulServerFilter(func(request *restful.Request, response *restful.Response, chain *restful.FilterChain) {
+ println("filter2")
+ chain.ProcessFilter(request, response)
+ })
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/general/rest/go-server/app/user.go b/golang/general/rest/go-server/app/user.go
new file mode 100755
index 0000000..0967f3f
--- /dev/null
+++ b/golang/general/rest/go-server/app/user.go
@@ -0,0 +1,78 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "time"
+)
+
+type Gender int
+
+const (
+ MAN = iota
+ WOMAN
+)
+
+var genderStrings = [...]string{
+ "MAN",
+ "WOMAN",
+}
+
+func (g Gender) String() string {
+ return genderStrings[g]
+}
+
+type (
+ User struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Age int `json:"age"`
+ sex Gender
+ Birth int `json:"time"`
+ Sex string `json:"sex"`
+ }
+)
+
+var (
+ DefaultUser = User{
+ Id: "0", Name: "Alex Stocks", Age: 31,
+ // Birth: int(time.Date(1985, time.November, 10, 23, 0, 0, 0, time.UTC).Unix()),
+ Birth: int(time.Date(1985, 11, 24, 15, 15, 0, 0, time.Local).Unix()),
+ sex: Gender(MAN),
+ }
+
+ userMap = make(map[string]User)
+)
+
+func init() {
+ DefaultUser.Sex = DefaultUser.sex.String()
+ userMap["A000"] = DefaultUser
+ userMap["A001"] = User{Id: "001", Name: "ZhangSheng", Age: 18, sex: MAN}
+ userMap["A002"] = User{Id: "002", Name: "Lily", Age: 20, sex: WOMAN}
+ userMap["A003"] = User{Id: "113", Name: "Moorse中文", Age: 30, sex: MAN}
+ for k, v := range userMap {
+ v.Birth = int(time.Now().AddDate(-1*v.Age, 0, 0).Unix())
+ v.Sex = userMap[k].sex.String()
+ userMap[k] = v
+ }
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/general/rest/go-server/app/user_provider.go b/golang/general/rest/go-server/app/user_provider.go
new file mode 100755
index 0000000..a53f361
--- /dev/null
+++ b/golang/general/rest/go-server/app/user_provider.go
@@ -0,0 +1,88 @@
+package main
+
+import (
+ "context"
+ "fmt"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ println("req:%#v", req)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider) GetUser0(id string, name string, age int) (*User, error) {
+ var err error
+
+ println("id:%s, name:%s, age:%d", id, name, age)
+ user, err := u.getUser(id)
+ if err != nil {
+ return &User{}, err
+ }
+ if user.Name != name {
+ return &User{}, perrors.New("name is not " + user.Name)
+ }
+ if user.Age != age {
+ return &User{}, perrors.New(fmt.Sprintf("age is not %d", user.Age))
+ }
+ return user, err
+}
+
+func (u *UserProvider) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider) GetUsers(req []interface{}) ([]User, error) {
+ var err error
+
+ println("req:%s", req)
+ t := req[0].(map[string]interface{})
+ user, err := u.getUser(t["ID"].(string))
+ if err != nil {
+ return nil, err
+ }
+ println("user:%v", user)
+
+ return []User{*user}, err
+}
+
+func (u *UserProvider) GetUser1(req []interface{}) (*User, error) {
+ err := perrors.New("test error")
+ return nil, err
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
diff --git a/golang/general/rest/go-server/app/user_provider1.go b/golang/general/rest/go-server/app/user_provider1.go
new file mode 100755
index 0000000..f81b9dd
--- /dev/null
+++ b/golang/general/rest/go-server/app/user_provider1.go
@@ -0,0 +1,78 @@
+package main
+
+import (
+ "context"
+ "fmt"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider1))
+}
+
+type UserProvider1 struct {
+}
+
+func (u *UserProvider1) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider1) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ println("req:%#v", req)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider1) GetUser0(id string, name string, age int) (User, error) {
+ var err error
+
+ println("id:%s, name:%s, age:%d", id, name, age)
+ user, err := u.getUser(id)
+ if err != nil {
+ return User{}, err
+ }
+ if user.Name != name {
+ return User{}, perrors.New("name is not " + user.Name)
+ }
+ if user.Age != age {
+ return User{}, perrors.New(fmt.Sprintf("age is not %d", user.Age))
+ }
+ return *user, err
+}
+
+func (u *UserProvider1) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider1) GetUsers(req []interface{}) ([]User, error) {
+ return []User{}, nil
+}
+
+func (u *UserProvider1) GetUser1(req []interface{}) (*User, error) {
+ err := perrors.New("test error")
+ return nil, err
+}
+
+func (u *UserProvider1) Reference() string {
+ return "UserProvider1"
+}
diff --git a/golang/general/rest/go-server/app/user_provider2.go b/golang/general/rest/go-server/app/user_provider2.go
new file mode 100755
index 0000000..c048acc
--- /dev/null
+++ b/golang/general/rest/go-server/app/user_provider2.go
@@ -0,0 +1,88 @@
+package main
+
+import (
+ "context"
+ "fmt"
+)
+
+import (
+ perrors "github.com/pkg/errors"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider2))
+}
+
+type UserProvider2 struct {
+}
+
+func (u *UserProvider2) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider2) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ println("req:%#v", req)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider2) GetUser0(id string, name string, age int) (User, error) {
+ var err error
+
+ println("id:%s, name:%s, age:%d", id, name, age)
+ user, err := u.getUser(id)
+ if err != nil {
+ return User{}, err
+ }
+ if user.Name != name {
+ return User{}, perrors.New("name is not " + user.Name)
+ }
+ if user.Age != age {
+ return User{}, perrors.New(fmt.Sprintf("age is not %d", user.Age))
+ }
+ return *user, err
+}
+
+func (u *UserProvider2) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider2) GetUsers(req []interface{}) ([]User, error) {
+ var err error
+
+ println("req:%s", req)
+ t := req[0].(map[string]interface{})
+ user, err := u.getUser(t["ID"].(string))
+ if err != nil {
+ return nil, err
+ }
+ println("user:%v", user)
+
+ return []User{*user}, err
+}
+
+func (u *UserProvider2) GetUser1(req []interface{}) (*User, error) {
+ err := perrors.New("test error")
+ return nil, err
+}
+
+func (u *UserProvider2) Reference() string {
+ return "UserProvider2"
+}
diff --git a/golang/general/rest/go-server/app/version.go b/golang/general/rest/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/general/rest/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/general/rest/go-server/assembly/bin/load.sh b/golang/general/rest/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/general/rest/go-server/assembly/common/app.properties b/golang/general/rest/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/general/rest/go-server/assembly/common/build.sh b/golang/general/rest/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/general/rest/go-server/assembly/linux/dev.sh b/golang/general/rest/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/linux/release.sh b/golang/general/rest/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/linux/test.sh b/golang/general/rest/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/mac/dev.sh b/golang/general/rest/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/mac/release.sh b/golang/general/rest/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/mac/test.sh b/golang/general/rest/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/windows/dev.sh b/golang/general/rest/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/windows/release.sh b/golang/general/rest/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/assembly/windows/test.sh b/golang/general/rest/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/general/rest/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/general/rest/go-server/profiles/dev/log.yml b/golang/general/rest/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..3ed242d
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/general/rest/go-server/profiles/dev/server.yml b/golang/general/rest/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..0c60ac1
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/dev/server.yml
@@ -0,0 +1,127 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider2"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json;charset=utf-8"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+protocols:
+ "rest":
+ name: "rest"
+ ip: "127.0.0.1"
+ port: 8888
+
diff --git a/golang/general/rest/go-server/profiles/release/log.yml b/golang/general/rest/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..d860624
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/general/rest/go-server/profiles/release/server.yml b/golang/general/rest/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..9926912
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/release/server.yml
@@ -0,0 +1,128 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider2"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json;charset=utf-8"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+protocols:
+ "rest":
+ name: "rest"
+ ip: "127.0.0.1"
+ port: 8888
+
diff --git a/golang/general/rest/go-server/profiles/test/log.yml b/golang/general/rest/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..f93d3c7
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/general/rest/go-server/profiles/test/server.yml b/golang/general/rest/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..b06bb6e
--- /dev/null
+++ b/golang/general/rest/go-server/profiles/test/server.yml
@@ -0,0 +1,134 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "rest"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider1"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "rest"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ rest_path: "/UserProvider2"
+ methods:
+ - name: "GetUser"
+ rest_path: "/GetUser"
+ rest_method: "GET"
+ rest_query_params: "0:id"
+ - name: "GetUser0"
+ rest_path: "/GetUser0/{id}"
+ rest_method: "POST"
+ rest_query_params: "1:name,2:age"
+ rest_path_params: "0:id"
+ rest_produces: "application/json;charset=utf-8"
+ rest_consumes: "application/json;charset=utf-8,*/*"
+
+ - name: "GetUser3"
+ rest_path: "/GetUser3"
+ rest_method: "GET"
+ - name: "GetUsers"
+ rest_path: "/GetUsers"
+ rest_method: "POST"
+ rest_body: 0
+ - name: "GetUser1"
+ rest_path: "/GetUser1"
+ rest_method: "GET"
+
+protocols:
+ "rest":
+ name: "rest"
+ ip: "127.0.0.1"
+ port: 8888
+
diff --git a/golang/generic/go-client/app/client.go b/golang/generic/go-client/app/client.go
index c8e8955..2ed8554 100755
--- a/golang/generic/go-client/app/client.go
+++ b/golang/generic/go-client/app/client.go
@@ -18,6 +18,7 @@
package main
import (
+ "context"
"fmt"
"os"
"os/signal"
@@ -95,7 +96,7 @@
time.Sleep(3 * time.Second)
println("\n\n\nstart to generic invoke")
- resp, err := referenceConfig.GetRPCService().(*config.GenericService).Invoke([]interface{}{"GetUser", []string{"java.lang.String"}, []interface{}{"A003"}})
+ resp, err := referenceConfig.GetRPCService().(*config.GenericService).Invoke(context.TODO(), []interface{}{"GetUser", []string{"java.lang.String"}, []interface{}{"A003"}})
if err != nil {
panic(err)
}
@@ -122,7 +123,7 @@
Age: 25,
Time: time.Now(),
}
- resp, err := referenceConfig.GetRPCService().(*config.GenericService).Invoke([]interface{}{"queryUser", []string{"com.ikurento.user.User"}, []interface{}{user}})
+ resp, err := referenceConfig.GetRPCService().(*config.GenericService).Invoke(context.TODO(), []interface{}{"queryUser", []string{"com.ikurento.user.User"}, []interface{}{user}})
if err != nil {
panic(err)
}
diff --git a/golang/go.mod b/golang/go.mod
index b10ab89..8afeeff 100644
--- a/golang/go.mod
+++ b/golang/go.mod
@@ -1,10 +1,17 @@
module github.com/apache/dubbo-samples/golang
require (
- github.com/apache/dubbo-go v1.3.0
- github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac
+ github.com/apache/dubbo-go v1.4.1
+ github.com/apache/dubbo-go-hessian2 v1.6.1-0.20200623062814-707fde850279
+ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
+ github.com/emicklei/go-restful/v3 v3.0.0
github.com/golang/protobuf v1.3.2
- github.com/pkg/errors v0.8.1
+ 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
+ github.com/pkg/errors v0.9.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.22.1
)
diff --git a/golang/go.sum b/golang/go.sum
index 5244458..e2da39b 100644
--- a/golang/go.sum
+++ b/golang/go.sum
@@ -7,25 +7,39 @@
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Jeffail/gabs v1.1.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Microsoft/go-winio v0.4.3/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
+github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.0.1/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
+github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
+github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/SAP/go-hdb v0.12.0/go.mod h1:etBT+FAi1t5k3K3tf5vQTnosgYmhDkRi8jEnQqCnxF0=
github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA=
+github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
+github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo=
github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
+github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 h1:rFw4nCn9iMW+Vajsk51NtYIcwSTkXr+JGrMd36kTDJw=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e h1:MSuLXx/mveDbpDNhVrcWTMeV4lbYWKcyO4rH+jAxmX0=
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190802083043-4cd0c391755e/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ=
+github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA=
+github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk=
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
-github.com/apache/dubbo-go v1.3.0 h1:nnLWzk80/LRLB4uhzVn1bfOZ5U98Sx1VjgyQLInbak8=
-github.com/apache/dubbo-go v1.3.0/go.mod h1:tVZrQi0iQRLAsypxtJ05/JH4JbuMcxPEOGi1i49PUP4=
-github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac h1:QKRMidg/RbdI5oaQWMb8Lxo63S+fLmsgMxsFoOCftKw=
-github.com/apache/dubbo-go-hessian2 v1.3.1-0.20200111150223-4ce8c8d0d7ac/go.mod h1:VwEnsOMidkM1usya2uPfGpSLO9XUF//WQcWn3y+jFz8=
+github.com/apache/dubbo-go v1.4.1 h1:YjPPpoaM1hMnRtB45CCyd4PxGtP5DsGHQPYOytiaICA=
+github.com/apache/dubbo-go v1.4.1/go.mod h1:hzP9PQkcYFcBUgedttDeimugDNqbmGzh18QQy/vBjnw=
+github.com/apache/dubbo-go-hessian2 v1.4.0 h1:Cb9FQVTy3G93dnDr7P93U8DeKFYpDTJjQp44JG5TafA=
+github.com/apache/dubbo-go-hessian2 v1.4.0/go.mod h1:VwEnsOMidkM1usya2uPfGpSLO9XUF//WQcWn3y+jFz8=
+github.com/apache/dubbo-go-hessian2 v1.5.0 h1:fzulDG5G7nX0ccgKdiN9XipJ7tZ4WXKgmk4stdlDS6s=
+github.com/apache/dubbo-go-hessian2 v1.5.0/go.mod h1:VwEnsOMidkM1usya2uPfGpSLO9XUF//WQcWn3y+jFz8=
+github.com/apache/dubbo-go-hessian2 v1.6.1-0.20200623062814-707fde850279 h1:1g3IJdaUjXWs++NA9Ail8+r6WgrkfhjS6hD/YXvRzjk=
+github.com/apache/dubbo-go-hessian2 v1.6.1-0.20200623062814-707fde850279/go.mod h1:7rEw9guWABQa6Aqb8HeZcsYPHsOS7XT1qtJvkmI6c5w=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
@@ -35,6 +49,7 @@
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
@@ -46,35 +61,62 @@
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
+github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/containerd/continuity v0.0.0-20181203112020-004b46473808/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
+github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY=
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
+github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/creasty/defaults v1.3.0 h1:uG+RAxYbJgOPCOdKEcec9ZJXeva7Y6mj/8egdzwmLtw=
github.com/creasty/defaults v1.3.0/go.mod h1:CIEEvs7oIVZm30R8VxtFJs+4k201gReYyuYHJxZc68I=
+github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisenkom/go-mssqldb v0.0.0-20180620032804-94c9c97e8c9f/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc=
github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU=
github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU=
github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
-github.com/dubbogo/getty v1.3.2 h1:l1KVSs/1CtTKbIPTrkTtBT6S9ddvmswDGoAnnl2CDpM=
-github.com/dubbogo/getty v1.3.2/go.mod h1:ANbVQ9tbpZ2b0xdR8nRrgS/oXIsZAeRxzvPSOn/7mbk=
+github.com/dubbogo/getty v1.3.3 h1:8m4zZBqFHO+NmhH7rMPlFuuYRVjcPD7cUhumevqMZZs=
+github.com/dubbogo/getty v1.3.3/go.mod h1:U92BDyJ6sW9Jpohr2Vlz8w2uUbIbNZ3d+6rJvFTSPp0=
+github.com/dubbogo/getty v1.3.5 h1:xJxdDj9jm7wlrRSsVZSk2TDNxJbbac5GpxV0QpjO+Tw=
+github.com/dubbogo/getty v1.3.5/go.mod h1:T55vN8Q6tZjf2AQZiGmkujneD3LfqYbv2b3QjacwYOY=
+github.com/dubbogo/getty v1.3.7 h1:xlkYD2/AH34iGteuLMsGjLl2PwBVrbIhHjf3tlUsv1M=
+github.com/dubbogo/getty v1.3.7/go.mod h1:XWO4+wAaMqgnBN9Ykv2YxxOAkGxymg6LGO9RK+EiCDY=
github.com/dubbogo/go-zookeeper v1.0.0 h1:RsYdlGwhDW+iKXM3eIIcvt34P2swLdmQfuIJxsHlGoM=
github.com/dubbogo/go-zookeeper v1.0.0/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
+github.com/dubbogo/go-zookeeper v1.0.1 h1:irLzvOsDOTNsN8Sv9tvYYxVu6DCQfLtziZQtUHmZgz8=
+github.com/dubbogo/go-zookeeper v1.0.1/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/gost v1.5.1 h1:oG5dzaWf1KYynBaBoUIOkgT+YD0niHV6xxI0Odq7hDg=
github.com/dubbogo/gost v1.5.1/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/dubbogo/gost v1.5.2 h1:ri/03971hdpnn3QeCU+4UZgnRNGDXLDGDucR/iozZm8=
github.com/dubbogo/gost v1.5.2/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
+github.com/dubbogo/gost v1.8.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
+github.com/dubbogo/gost v1.9.0 h1:UT+dWwvLyJiDotxJERO75jB3Yxgsdy10KztR5ycxRAk=
+github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/duosecurity/duo_api_golang v0.0.0-20190308151101-6c680f768e74/go.mod h1:UqXY1lYT/ERa4OEAywUqdok1T4RCRdArkhic1Opuavo=
+github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
+github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
+github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
+github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
+github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
+github.com/emicklei/go-restful/v3 v3.0.0 h1:Duxxa4x0WIHW3bYEDmoAPNjmy8Rbqn+utcF74dlF/G8=
+github.com/emicklei/go-restful/v3 v3.0.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
+github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.8.0/go.mod h1:GSSbY9P1neVhdY7G4wu+IK1rk/dqhiCC/4ExuWJZVuk=
github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
@@ -82,7 +124,11 @@
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structs v0.0.0-20180123065059-ebf56d35bba7/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/go-co-op/gocron v0.1.1 h1:OfDmkqkCguFtFMsm6Eaayci3DADLa8pXvdmOlPU/JcU=
+github.com/go-co-op/gocron v0.1.1/go.mod h1:Y9PWlYqDChf2Nbgg7kfS+ZsXHDTZbMZYPEQ0MILqH+M=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
@@ -91,20 +137,31 @@
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
+github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
+github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
+github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
+github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
+github.com/go-redis/redis v6.15.5+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
+github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsldE=
+github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/go-sql-driver/mysql v0.0.0-20180618115901-749ddf1598b4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gocql/gocql v0.0.0-20180617115710-e06f8c1bcd78/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
@@ -114,29 +171,45 @@
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4=
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
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/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
+github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
+github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
+github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
+github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hashicorp/consul v1.5.3/go.mod h1:61E2GJCPEP3oq8La7sfDdWGQ66+Zbxzw5ecOdFD7xIE=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
+github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-bexpr v0.1.0/go.mod h1:ANbpTX1oAql27TZkKVeW8p1w8NTdnyzPe/0qqPCKohU=
github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4=
@@ -171,6 +244,7 @@
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
+github.com/hashicorp/vault v0.10.3 h1:3Hf6mwC4rggOq6ViWSoJ2yfk1oBS5ed58LLcP33gmEg=
github.com/hashicorp/vault v0.10.3/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0=
github.com/hashicorp/vault-plugin-secrets-kv v0.0.0-20190318174639-195e0e9d07f1/go.mod h1:VJHHT2SC1tAPrfENQeBhLlb5FbZoKZM+oC/ROmEftz0=
github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443/go.mod h1:bEpDU35nTu0ey1EXjwNwPjI9xErAsoOCmcMb9GKvyxo=
@@ -189,6 +263,7 @@
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA=
+github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
@@ -196,10 +271,15 @@
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/juju/errors v0.0.0-20190930114154-d42613fe1ab9 h1:hJix6idebFclqlfZCHE7EUX7uqLCyb70nHNHH1XKGBg=
+github.com/juju/errors v0.0.0-20190930114154-d42613fe1ab9/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
+github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
+github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/keybase/go-crypto v0.0.0-20180614160407-5114a9a81e1b/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
@@ -214,10 +294,13 @@
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 h1:Bvq8AziQ5jFF4BHGAEDSqwPW1NJS3XshxbRCxtjFAZc=
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0=
github.com/lib/pq v0.0.0-20180523175426-90697d60dd84/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
@@ -235,75 +318,120 @@
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
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/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=
github.com/nacos-group/nacos-sdk-go v0.0.0-20190723125407-0242d42e3dbb h1:lbmvw8r9W55w+aQgWn35W1nuleRIECMoqUrmwAOAvoI=
github.com/nacos-group/nacos-sdk-go v0.0.0-20190723125407-0242d42e3dbb/go.mod h1:CEkSvEpoveoYjA81m4HNeYQ0sge0LFGKSEqO3JKHllo=
+github.com/nacos-group/nacos-sdk-go v0.0.0-20191128082542-fe1b325b125c/go.mod h1:CEkSvEpoveoYjA81m4HNeYQ0sge0LFGKSEqO3JKHllo=
+github.com/nacos-group/nacos-sdk-go v0.3.1 h1:MI7bNDAN5m9UFcRRUTSPfJi4dCQo+TYG85qVB1rCHeg=
+github.com/nacos-group/nacos-sdk-go v0.3.1/go.mod h1:ESKb6yF0gxSc8GuS+0jaMBe+n8rJ5/k4ya6LyFG2xi8=
+github.com/nacos-group/nacos-sdk-go v0.3.2/go.mod h1:4TdsN7eZnnVCDlOlBa61b0gsRnvNJI74m9+2+OKZkcw=
+github.com/nacos-group/nacos-sdk-go v0.3.3-0.20200617023039-50c7537d6a5f/go.mod h1:fti1GlX/EB6RDKvzK/P7Vuibqj0JMPJHQwrcTU1tLXk=
github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk=
github.com/oklog/run v0.0.0-20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 h1:lM6RxxfUMrYL/f8bWEUqdXrANWtrL7Nndbm9iFN0DlU=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
+github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5 h1:ZCnq+JUrvXcDVhX/xRolRBZifmabN1HcS1wrPSvxhrU=
+github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
+github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
+github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI=
+github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/ory/dockertest v3.3.4+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=
github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otzZQXgoO96RTzDB/Hycg0qZcXZsWJGJRSXbmEIJ+4M=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v0.0.0-20180527043350-9f6ff22cfff8/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
+github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
+github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
+github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM=
+github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
+github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
+github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945 h1:N8Bg45zpk/UcpNGnfJt2y/3lRWASHNTUET8owPYCgYI=
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d/go.mod h1:Cw4GTlQccdRGSEf6KiMju767x0NEHE0YIVPJSaXjlsw=
+github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
+github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/tebeka/strftime v0.1.3 h1:5HQXOqWKYRFfNyBMNVc9z5+QzuBtIXy03psIhtdJYto=
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8=
@@ -313,24 +441,45 @@
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 h1:kF/7m/ZU+0D4Jj5eZ41Zm3IH/J8OElK1Qtd7tVKAwLk=
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
+github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM=
+github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
+github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=
+github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
+github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/zouyx/agollo v0.0.0-20191114083447-dde9fc9f35b8 h1:k8TV7Gz7cpWpOw/dz71fx8cCZdWoPuckHJ/wkJl+meg=
github.com/zouyx/agollo v0.0.0-20191114083447-dde9fc9f35b8/go.mod h1:S1cAa98KMFv4Sa8SbJ6ZtvOmf0VlgH0QJ1gXI0lBfBY=
+go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
+go.etcd.io/etcd v3.3.13+incompatible h1:jCejD5EMnlGxFvcGRyEV4VGlENZc7oPQX6o0t7n3xbw=
go.etcd.io/etcd v3.3.13+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
+go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
+go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM=
+go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -338,16 +487,23 @@
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
+golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20170807180024-9a379c6b3e95/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -356,36 +512,51 @@
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190508220229-2d0786266e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
+golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20180829000535-087779f1d2c9/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
google.golang.org/grpc v1.22.1 h1:/7cs52RnTJmD43s3uxzlq2U7nqVTd/37viQwMrMNlOM=
google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
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=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
@@ -400,12 +571,19 @@
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
istio.io/gogo-genproto v0.0.0-20190124151557-6d926a6e6feb/go.mod h1:eIDJ6jNk/IeJz6ODSksHl5Aiczy5JUq6vFhJWI5OtiI=
k8s.io/api v0.0.0-20180806132203-61b11ee65332/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/api v0.0.0-20190325185214-7544f9db76f6/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/apimachinery v0.0.0-20180821005732-488889b0007f/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
+k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
+k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
+k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
+sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
+sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
diff --git a/golang/registry/etcd/README.md b/golang/registry/etcd/README.md
new file mode 100644
index 0000000..dcfd091
--- /dev/null
+++ b/golang/registry/etcd/README.md
@@ -0,0 +1,141 @@
+# etcd
+
+use etcd for registry
+
+# config
+
+## go-server/profiles/dev/server.yml
+
+```yaml
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "etcd":
+ protocol: "etcdv3"
+ timeout : "3s"
+ address: "127.0.0.1:2379"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "etcd" # 特别注意这里
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
+```
+
+## go-client/profiles/dev/client.yml
+
+```yaml
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "etcd":
+ protocol: "etcdv3"
+ timeout : "3s"
+ address: "127.0.0.1:2379"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
+```
+
+## import etcd
+
+import `github.com/apache/dubbo-go/registry/etcdv3` in `go-client/app/client.go` and `go-server/app/server.go`
+
+```go
+// import etcdv3 to init etcdv3 registry
+_ "github.com/apache/dubbo-go/registry/etcdv3"
+```
\ No newline at end of file
diff --git a/golang/registry/etcd/go-client/app/client.go b/golang/registry/etcd/go-client/app/client.go
new file mode 100644
index 0000000..e2fc934
--- /dev/null
+++ b/golang/registry/etcd/go-client/app/client.go
@@ -0,0 +1,77 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+
+ // import etcdv3 to init etcdv3 registry
+ _ "github.com/apache/dubbo-go/registry/etcdv3"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ 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/golang/registry/etcd/go-client/app/user.go b/golang/registry/etcd/go-client/app/user.go
new file mode 100644
index 0000000..da98c72
--- /dev/null
+++ b/golang/registry/etcd/go-client/app/user.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "context"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/registry/etcd/go-client/app/version.go b/golang/registry/etcd/go-client/app/version.go
new file mode 100644
index 0000000..60c1a81
--- /dev/null
+++ b/golang/registry/etcd/go-client/app/version.go
@@ -0,0 +1,5 @@
+package main
+
+var (
+ Version = "2.6.0"
+)
diff --git a/golang/registry/etcd/go-client/assembly/bin/load.sh b/golang/registry/etcd/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..598bbcb
--- /dev/null
+++ b/golang/registry/etcd/go-client/assembly/bin/load.sh
@@ -0,0 +1,184 @@
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-client/assembly/common/app.properties b/golang/registry/etcd/go-client/assembly/common/app.properties
new file mode 100644
index 0000000..5708ca9
--- /dev/null
+++ b/golang/registry/etcd/go-client/assembly/common/app.properties
@@ -0,0 +1,6 @@
+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"
\ No newline at end of file
diff --git a/golang/registry/etcd/go-client/assembly/common/build.sh b/golang/registry/etcd/go-client/assembly/common/build.sh
new file mode 100644
index 0000000..2afbb49
--- /dev/null
+++ b/golang/registry/etcd/go-client/assembly/common/build.sh
@@ -0,0 +1,65 @@
+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}/*
\ No newline at end of file
diff --git a/golang/registry/etcd/go-client/assembly/mac/dev.sh b/golang/registry/etcd/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..d242789
--- /dev/null
+++ b/golang/registry/etcd/go-client/assembly/mac/dev.sh
@@ -0,0 +1,17 @@
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-client/profiles/dev/client.yml b/golang/registry/etcd/go-client/profiles/dev/client.yml
new file mode 100644
index 0000000..f3b4b17
--- /dev/null
+++ b/golang/registry/etcd/go-client/profiles/dev/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "etcd":
+ protocol: "etcdv3"
+ timeout : "3s"
+ address: "127.0.0.1:2379"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/etcd/go-client/profiles/dev/log.yml b/golang/registry/etcd/go-client/profiles/dev/log.yml
new file mode 100644
index 0000000..1d68ea3
--- /dev/null
+++ b/golang/registry/etcd/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/app/server.go b/golang/registry/etcd/go-server/app/server.go
new file mode 100644
index 0000000..0a85fa2
--- /dev/null
+++ b/golang/registry/etcd/go-server/app/server.go
@@ -0,0 +1,64 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/common/logger"
+ "github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+
+ // import etcdv3 to init etcdv3 registry
+ _ "github.com/apache/dubbo-go/registry/etcdv3"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+
+ logger.Info("xxx")
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/registry/etcd/go-server/app/user.go b/golang/registry/etcd/go-server/app/user.go
new file mode 100644
index 0000000..e094dbc
--- /dev/null
+++ b/golang/registry/etcd/go-server/app/user.go
@@ -0,0 +1,47 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/registry/etcd/go-server/app/version.go b/golang/registry/etcd/go-server/app/version.go
new file mode 100644
index 0000000..60c1a81
--- /dev/null
+++ b/golang/registry/etcd/go-server/app/version.go
@@ -0,0 +1,5 @@
+package main
+
+var (
+ Version = "2.6.0"
+)
diff --git a/golang/registry/etcd/go-server/assembly/bin/load.sh b/golang/registry/etcd/go-server/assembly/bin/load.sh
new file mode 100644
index 0000000..d247297
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/bin/load.sh
@@ -0,0 +1,132 @@
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/assembly/common/app.properties b/golang/registry/etcd/go-server/assembly/common/app.properties
new file mode 100644
index 0000000..8e0d12b
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/common/app.properties
@@ -0,0 +1,6 @@
+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"
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/assembly/common/build.sh b/golang/registry/etcd/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..9b09954
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/common/build.sh
@@ -0,0 +1,62 @@
+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}/*
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/assembly/mac/dev.sh b/golang/registry/etcd/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..b1bca8b
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/mac/dev.sh
@@ -0,0 +1,17 @@
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/assembly/mac/release.sh b/golang/registry/etcd/go-server/assembly/mac/release.sh
new file mode 100644
index 0000000..9fa8786
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/mac/release.sh
@@ -0,0 +1,18 @@
+
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/assembly/mac/test.sh b/golang/registry/etcd/go-server/assembly/mac/test.sh
new file mode 100644
index 0000000..83e2d15
--- /dev/null
+++ b/golang/registry/etcd/go-server/assembly/mac/test.sh
@@ -0,0 +1,17 @@
+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
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/profiles/dev/log.yml b/golang/registry/etcd/go-server/profiles/dev/log.yml
new file mode 100644
index 0000000..ed4d3cb
--- /dev/null
+++ b/golang/registry/etcd/go-server/profiles/dev/log.yml
@@ -0,0 +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:
\ No newline at end of file
diff --git a/golang/registry/etcd/go-server/profiles/dev/server.yml b/golang/registry/etcd/go-server/profiles/dev/server.yml
new file mode 100644
index 0000000..cd78586
--- /dev/null
+++ b/golang/registry/etcd/go-server/profiles/dev/server.yml
@@ -0,0 +1,57 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "etcd":
+ protocol: "etcdv3"
+ timeout : "3s"
+ address: "127.0.0.1:2379"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "etcd"
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
\ No newline at end of file
diff --git a/golang/registry/servicediscovery/etcd/go-client/app/client.go b/golang/registry/servicediscovery/etcd/go-client/app/client.go
new file mode 100755
index 0000000..6507bbd
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/app/client.go
@@ -0,0 +1,100 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+
+ _ "github.com/apache/dubbo-go/metadata/mapping/dynamic"
+ _ "github.com/apache/dubbo-go/metadata/report/etcd"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/etcdv3"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ for i := 0; i < 5; i++ {
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ }
+ 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/golang/registry/servicediscovery/etcd/go-client/app/user.go b/golang/registry/servicediscovery/etcd/go-client/app/user.go
new file mode 100755
index 0000000..ff4486f
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/app/user.go
@@ -0,0 +1,54 @@
+/*
+ * 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
+
+import (
+ "context"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/registry/servicediscovery/etcd/go-client/app/version.go b/golang/registry/servicediscovery/etcd/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/etcd/go-client/assembly/bin/load.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/common/app.properties b/golang/registry/servicediscovery/etcd/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/etcd/go-client/assembly/common/build.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d38f889
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/linux/dev.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/linux/release.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/linux/test.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/mac/dev.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/mac/release.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/mac/test.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/windows/dev.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/windows/release.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/assembly/windows/test.sh b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/etcd/go-client/profiles/dev/client.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..3b812c2
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/dev/client.yml
@@ -0,0 +1,77 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "user-info-client"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "etcd1"
+ name_mapping: "in-memory"
+ metadata: "default"
+
+remote:
+ etcd:
+ address: "127.0.0.1:12379"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "etcdv3"
+ remote_ref: "etcd"
+
+service_discovery:
+ etcd1:
+ protocol: "etcdv3"
+ remote_ref: "etcd"
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol : "dubbo"
+ provide_by: "user-info-server"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/etcd/go-client/profiles/dev/log.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/etcd/go-client/profiles/release/client.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..baa4382
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/release/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/etcd/go-client/profiles/release/log.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/etcd/go-client/profiles/test/client.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..90d72a2
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/test/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/etcd/go-client/profiles/test/log.yml b/golang/registry/servicediscovery/etcd/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/etcd/go-server/app/server.go b/golang/registry/servicediscovery/etcd/go-server/app/server.go
new file mode 100755
index 0000000..6a61ba8
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/app/server.go
@@ -0,0 +1,87 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "github.com/apache/dubbo-go/common/logger"
+ "github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/registry/etcdv3"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/metadata/mapping/memory"
+ _ "github.com/apache/dubbo-go/metadata/report/etcd"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ // hessian.RegisterPOJO(service.String(""))
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/registry/servicediscovery/etcd/go-server/app/user.go b/golang/registry/servicediscovery/etcd/go-server/app/user.go
new file mode 100755
index 0000000..6410074
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/app/user.go
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/registry/servicediscovery/etcd/go-server/app/version.go b/golang/registry/servicediscovery/etcd/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/etcd/go-server/assembly/bin/load.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/common/app.properties b/golang/registry/servicediscovery/etcd/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/etcd/go-server/assembly/common/build.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/linux/dev.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/linux/release.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/linux/test.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/mac/dev.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/mac/release.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/mac/test.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/windows/dev.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/windows/release.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/assembly/windows/test.sh b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/etcd/go-server/profiles/dev/log.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/etcd/go-server/profiles/dev/server.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..92cf4e0
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/dev/server.yml
@@ -0,0 +1,75 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "etcd1"
+ name_mapping: "in-memory"
+ metadata: "default"
+
+remote:
+ etcd:
+ address: "127.0.0.1:12379"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "etcdv3"
+ remote_ref: "etcd"
+
+service_discovery:
+ etcd1:
+ protocol: "etcdv3"
+ remote_ref: "etcd"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/etcd/go-server/profiles/release/log.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/etcd/go-server/profiles/release/server.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/release/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/etcd/go-server/profiles/test/log.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/etcd/go-server/profiles/test/server.yml b/golang/registry/servicediscovery/etcd/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/go-server/profiles/test/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/etcd/java-client/build.sh b/golang/registry/servicediscovery/etcd/java-client/build.sh
new file mode 100755
index 0000000..c869acf
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/build.sh
@@ -0,0 +1,21 @@
+#!/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/golang/registry/servicediscovery/etcd/java-client/pom.xml b/golang/registry/servicediscovery/etcd/java-client/pom.xml
new file mode 100755
index 0000000..5fc8342
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/pom.xml
@@ -0,0 +1,131 @@
+<?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>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>com.alibaba.nacos</groupId>-->
+<!-- <artifactId>nacos-client</artifactId>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/golang/registry/servicediscovery/etcd/java-client/settings.xml b/golang/registry/servicediscovery/etcd/java-client/settings.xml
new file mode 100644
index 0000000..68d689e
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/settings.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>apache</id>
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>apache.releases.https</id>
+ <name>Apache Release Distribution Repository</name>
+ <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>apache</activeProfile>
+ </activeProfiles>
+</settings>
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/etcd/java-client/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..bc00a06
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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/resources</directory>
+ <includes>
+ <include>dubbo.properties</include>
+ <include>log4j.*</include>
+ </includes>
+ <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/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/Consumer.java b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/Consumer.java
new file mode 100755
index 0000000..b3b4b23
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/Consumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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 Consumer {
+ public static void main(String[] args) {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml");
+ context.start();
+ UserProvider userProvider = context.getBean("demoService", UserProvider.class);
+// try {
+// Thread.sleep(100000);
+// } catch (Exception e) {
+// }
+ User hello = userProvider.GetUser("mindeng");
+ System.out.println("result: " + hello);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..666e904
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Date;
+
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+}
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..67a836a
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+package com.ikurento.user;
+
+public interface UserProvider {
+ User GetUser(String userId);
+}
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
new file mode 100755
index 0000000..d3b2c46
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
@@ -0,0 +1,41 @@
+<?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="dubbo" name="dubbo" />-->
+<!-- <dubbo:protocol id="jsonrpc" name="jsonrpc" />-->
+
+ <dubbo:registry address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <!-- 声明需要使用的服务接口 -->
+<!-- <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="">-->
+ <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
+<!-- </dubbo:reference>-->
+
+ <dubbo:reference id="demoService" check="false" interface="com.ikurento.user.UserProvider" provided-by="BDTService"/>
+</beans>
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/service.xml b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/service.xml
new file mode 100755
index 0000000..563b838
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/META-INF/spring/service.xml
@@ -0,0 +1,27 @@
+<?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>-->
+
+</beans>
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e561efc
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/dubbo.properties
@@ -0,0 +1,13 @@
+### 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 = dubbo
+
+dubbo.log4j.file = logs/client.log
+dubbo.log4j.level = WARN
diff --git a/golang/registry/servicediscovery/etcd/java-client/src/main/resources/log4j.properties b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/log4j.properties
new file mode 100755
index 0000000..de4da25
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-client/src/main/resources/log4j.properties
@@ -0,0 +1,19 @@
+## Logger configure file for myproject
+log.dir=logs/
+datestamp=yyyy-MM-dd/HH:mm:ss.SSS
+
+log4j.rootLogger=INFO, file, console
+
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.threshold=INFO
+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/golang/registry/servicediscovery/etcd/java-server/build.sh b/golang/registry/servicediscovery/etcd/java-server/build.sh
new file mode 100755
index 0000000..7b5755b
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/build.sh
@@ -0,0 +1,20 @@
+#!/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/golang/registry/servicediscovery/etcd/java-server/pom.xml b/golang/registry/servicediscovery/etcd/java-server/pom.xml
new file mode 100755
index 0000000..bd351cc
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/pom.xml
@@ -0,0 +1,198 @@
+<?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.6.5</dubbo-version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>com.alibaba.nacos</groupId>-->
+ <!-- <artifactId>nacos-client</artifactId>-->
+ <!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>nexus-aliyu</id>
+ <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.alibaba</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>
+ <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/golang/registry/servicediscovery/etcd/java-server/script/debug.sh b/golang/registry/servicediscovery/etcd/java-server/script/debug.sh
new file mode 100755
index 0000000..851957a
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/script/debug.sh
@@ -0,0 +1,23 @@
+#!/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/golang/registry/servicediscovery/etcd/java-server/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/etcd/java-server/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..5b4075c
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/assembly/assembly.xml
@@ -0,0 +1,44 @@
+<?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>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</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/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/Provider.java b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/Provider.java
new file mode 100755
index 0000000..8fb3685
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/Provider.java
@@ -0,0 +1,28 @@
+/*
+ * 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 {
+
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider.xml");
+ context.start();
+ System.in.read();
+ }
+}
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..fd2cafb
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,86 @@
+/*
+ * 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.util.Date;
+import java.io.Serializable;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
+ }
+}
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..b1eeab8
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface UserProvider {
+
+ User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
+
+}
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
new file mode 100755
index 0000000..0d66c43
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProviderImpl implements UserProvider {
+ private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
+
+ public User GetUser(String userId) {
+ return new User(userId, "zhangsan", 18);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
new file mode 100755
index 0000000..2f89e0d
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -0,0 +1,39 @@
+<?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:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" />
+ <!-- 声明需要暴露的服务接口 -->
+<!-- <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/>-->
+
+ <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
+
+
+ <!-- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>-->
+ <dubbo:registry id="nacos" address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <dubbo:protocol name="dubbo"/>
+
+ <dubbo:service registry="nacos" interface="com.ikurento.user.UserProvider" ref="demoService" weight="12"/>
+
+</beans>
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/dubbo.properties
diff --git a/golang/registry/servicediscovery/etcd/java-server/src/main/resources/log4j.properties b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/log4j.properties
new file mode 100755
index 0000000..13c8049
--- /dev/null
+++ b/golang/registry/servicediscovery/etcd/java-server/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+## 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/golang/registry/servicediscovery/nacos/go-client/app/client.go b/golang/registry/servicediscovery/nacos/go-client/app/client.go
new file mode 100755
index 0000000..82259ff
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/app/client.go
@@ -0,0 +1,103 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+
+ _ "github.com/apache/dubbo-go/config_center/nacos"
+
+ _ "github.com/apache/dubbo-go/metadata/mapping/dynamic"
+ _ "github.com/apache/dubbo-go/metadata/report/nacos"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/nacos"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ for i := 0; i< 5; i++ {
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ }
+ 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/golang/registry/servicediscovery/nacos/go-client/app/user.go b/golang/registry/servicediscovery/nacos/go-client/app/user.go
new file mode 100755
index 0000000..ff4486f
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/app/user.go
@@ -0,0 +1,54 @@
+/*
+ * 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
+
+import (
+ "context"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/registry/servicediscovery/nacos/go-client/app/version.go b/golang/registry/servicediscovery/nacos/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/nacos/go-client/assembly/bin/load.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/common/app.properties b/golang/registry/servicediscovery/nacos/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/nacos/go-client/assembly/common/build.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d38f889
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/linux/dev.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/linux/release.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/linux/test.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/mac/dev.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/mac/release.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/mac/test.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/windows/dev.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/windows/release.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/assembly/windows/test.sh b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/nacos/go-client/profiles/dev/client.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..834f2aa
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/dev/client.yml
@@ -0,0 +1,79 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "user-info-client"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/nacos/go-client/profiles/dev/log.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/nacos/go-client/profiles/release/client.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..baa4382
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/release/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/nacos/go-client/profiles/release/log.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/nacos/go-client/profiles/test/client.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..90d72a2
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/test/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/nacos/go-client/profiles/test/log.yml b/golang/registry/servicediscovery/nacos/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/nacos/go-server/app/server.go b/golang/registry/servicediscovery/nacos/go-server/app/server.go
new file mode 100755
index 0000000..fe42f65
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/app/server.go
@@ -0,0 +1,87 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "github.com/apache/dubbo-go/common/logger"
+ "github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/config_center/nacos"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/metadata/mapping/dynamic"
+ _ "github.com/apache/dubbo-go/metadata/report/nacos"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/nacos"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ // hessian.RegisterPOJO(service.String(""))
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/registry/servicediscovery/nacos/go-server/app/user.go b/golang/registry/servicediscovery/nacos/go-server/app/user.go
new file mode 100755
index 0000000..6410074
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/app/user.go
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/registry/servicediscovery/nacos/go-server/app/version.go b/golang/registry/servicediscovery/nacos/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/nacos/go-server/assembly/bin/load.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/common/app.properties b/golang/registry/servicediscovery/nacos/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/nacos/go-server/assembly/common/build.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/linux/dev.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/linux/release.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/linux/test.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/mac/dev.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/mac/release.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/mac/test.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/windows/dev.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/windows/release.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/assembly/windows/test.sh b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/nacos/go-server/profiles/dev/log.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/nacos/go-server/profiles/dev/server.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/dev/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/nacos/go-server/profiles/release/log.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/nacos/go-server/profiles/release/server.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/release/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/nacos/go-server/profiles/test/log.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/nacos/go-server/profiles/test/server.yml b/golang/registry/servicediscovery/nacos/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/go-server/profiles/test/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/nacos/java-client/build.sh b/golang/registry/servicediscovery/nacos/java-client/build.sh
new file mode 100755
index 0000000..c869acf
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/build.sh
@@ -0,0 +1,21 @@
+#!/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/golang/registry/servicediscovery/nacos/java-client/pom.xml b/golang/registry/servicediscovery/nacos/java-client/pom.xml
new file mode 100755
index 0000000..5fc8342
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/pom.xml
@@ -0,0 +1,131 @@
+<?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>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>com.alibaba.nacos</groupId>-->
+<!-- <artifactId>nacos-client</artifactId>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/golang/registry/servicediscovery/nacos/java-client/settings.xml b/golang/registry/servicediscovery/nacos/java-client/settings.xml
new file mode 100644
index 0000000..68d689e
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/settings.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>apache</id>
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>apache.releases.https</id>
+ <name>Apache Release Distribution Repository</name>
+ <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>apache</activeProfile>
+ </activeProfiles>
+</settings>
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/nacos/java-client/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..bc00a06
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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/resources</directory>
+ <includes>
+ <include>dubbo.properties</include>
+ <include>log4j.*</include>
+ </includes>
+ <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/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/Consumer.java b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/Consumer.java
new file mode 100755
index 0000000..b3b4b23
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/Consumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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 Consumer {
+ public static void main(String[] args) {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml");
+ context.start();
+ UserProvider userProvider = context.getBean("demoService", UserProvider.class);
+// try {
+// Thread.sleep(100000);
+// } catch (Exception e) {
+// }
+ User hello = userProvider.GetUser("mindeng");
+ System.out.println("result: " + hello);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..666e904
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Date;
+
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+}
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..67a836a
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+package com.ikurento.user;
+
+public interface UserProvider {
+ User GetUser(String userId);
+}
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
new file mode 100755
index 0000000..d3b2c46
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
@@ -0,0 +1,41 @@
+<?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="dubbo" name="dubbo" />-->
+<!-- <dubbo:protocol id="jsonrpc" name="jsonrpc" />-->
+
+ <dubbo:registry address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <!-- 声明需要使用的服务接口 -->
+<!-- <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="">-->
+ <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
+<!-- </dubbo:reference>-->
+
+ <dubbo:reference id="demoService" check="false" interface="com.ikurento.user.UserProvider" provided-by="BDTService"/>
+</beans>
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/service.xml b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/service.xml
new file mode 100755
index 0000000..563b838
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/META-INF/spring/service.xml
@@ -0,0 +1,27 @@
+<?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>-->
+
+</beans>
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e561efc
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/dubbo.properties
@@ -0,0 +1,13 @@
+### 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 = dubbo
+
+dubbo.log4j.file = logs/client.log
+dubbo.log4j.level = WARN
diff --git a/golang/registry/servicediscovery/nacos/java-client/src/main/resources/log4j.properties b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/log4j.properties
new file mode 100755
index 0000000..de4da25
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-client/src/main/resources/log4j.properties
@@ -0,0 +1,19 @@
+## Logger configure file for myproject
+log.dir=logs/
+datestamp=yyyy-MM-dd/HH:mm:ss.SSS
+
+log4j.rootLogger=INFO, file, console
+
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.threshold=INFO
+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/golang/registry/servicediscovery/nacos/java-server/build.sh b/golang/registry/servicediscovery/nacos/java-server/build.sh
new file mode 100755
index 0000000..7b5755b
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/build.sh
@@ -0,0 +1,20 @@
+#!/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/golang/registry/servicediscovery/nacos/java-server/pom.xml b/golang/registry/servicediscovery/nacos/java-server/pom.xml
new file mode 100755
index 0000000..bd351cc
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/pom.xml
@@ -0,0 +1,198 @@
+<?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.6.5</dubbo-version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>com.alibaba.nacos</groupId>-->
+ <!-- <artifactId>nacos-client</artifactId>-->
+ <!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>nexus-aliyu</id>
+ <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.alibaba</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>
+ <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/golang/registry/servicediscovery/nacos/java-server/script/debug.sh b/golang/registry/servicediscovery/nacos/java-server/script/debug.sh
new file mode 100755
index 0000000..851957a
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/script/debug.sh
@@ -0,0 +1,23 @@
+#!/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/golang/registry/servicediscovery/nacos/java-server/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/nacos/java-server/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..5b4075c
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/assembly/assembly.xml
@@ -0,0 +1,44 @@
+<?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>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</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/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/Provider.java b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/Provider.java
new file mode 100755
index 0000000..8fb3685
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/Provider.java
@@ -0,0 +1,28 @@
+/*
+ * 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 {
+
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider.xml");
+ context.start();
+ System.in.read();
+ }
+}
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..fd2cafb
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,86 @@
+/*
+ * 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.util.Date;
+import java.io.Serializable;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
+ }
+}
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..b1eeab8
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface UserProvider {
+
+ User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
+
+}
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
new file mode 100755
index 0000000..0d66c43
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProviderImpl implements UserProvider {
+ private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
+
+ public User GetUser(String userId) {
+ return new User(userId, "zhangsan", 18);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
new file mode 100755
index 0000000..2f89e0d
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -0,0 +1,39 @@
+<?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:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" />
+ <!-- 声明需要暴露的服务接口 -->
+<!-- <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/>-->
+
+ <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
+
+
+ <!-- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>-->
+ <dubbo:registry id="nacos" address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <dubbo:protocol name="dubbo"/>
+
+ <dubbo:service registry="nacos" interface="com.ikurento.user.UserProvider" ref="demoService" weight="12"/>
+
+</beans>
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/dubbo.properties
diff --git a/golang/registry/servicediscovery/nacos/java-server/src/main/resources/log4j.properties b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/log4j.properties
new file mode 100755
index 0000000..13c8049
--- /dev/null
+++ b/golang/registry/servicediscovery/nacos/java-server/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+## 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/golang/registry/servicediscovery/zookeeper/go-client/app/client.go b/golang/registry/servicediscovery/zookeeper/go-client/app/client.go
new file mode 100755
index 0000000..e4f5359
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/app/client.go
@@ -0,0 +1,100 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+
+ _ "github.com/apache/dubbo-go/metadata/mapping/dynamic"
+ _ "github.com/apache/dubbo-go/metadata/report/zookeeper"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ for i := 0; i < 5; i++ {
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ }
+ 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/golang/registry/servicediscovery/zookeeper/go-client/app/user.go b/golang/registry/servicediscovery/zookeeper/go-client/app/user.go
new file mode 100755
index 0000000..ff4486f
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/app/user.go
@@ -0,0 +1,54 @@
+/*
+ * 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
+
+import (
+ "context"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/app/version.go b/golang/registry/servicediscovery/zookeeper/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/assembly/bin/load.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/app.properties b/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/build.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d38f889
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/dev.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/release.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/test.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/dev.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/release.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/test.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/dev.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/release.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/test.sh b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/client.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..0c96803
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/client.yml
@@ -0,0 +1,77 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "user-info-client"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "zk-dis1"
+ name_mapping: "in-memory"
+ metadata: "default"
+
+remote:
+ zk1:
+ address: "127.0.0.1:2181"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "zookeeper"
+ remote_ref: "zk1"
+
+service_discovery:
+ zk-dis1:
+ protocol: "zookeeper"
+ remote_ref: "zk1"
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol : "dubbo"
+ provide_by: "user-info-server"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/log.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/client.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..baa4382
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/log.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/client.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..90d72a2
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 1024000
+ session_name: "client"
diff --git a/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/log.yml b/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/registry/servicediscovery/zookeeper/go-server/app/server.go b/golang/registry/servicediscovery/zookeeper/go-server/app/server.go
new file mode 100755
index 0000000..53a08cc
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/app/server.go
@@ -0,0 +1,87 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+
+ "github.com/apache/dubbo-go/common/logger"
+ "github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/metadata/mapping/memory"
+ _ "github.com/apache/dubbo-go/metadata/report/zookeeper"
+ _ "github.com/apache/dubbo-go/metadata/service/remote"
+ _ "github.com/apache/dubbo-go/registry/servicediscovery"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ // hessian.RegisterPOJO(service.String(""))
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/app/user.go b/golang/registry/servicediscovery/zookeeper/go-server/app/user.go
new file mode 100755
index 0000000..6410074
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/app/user.go
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/app/version.go b/golang/registry/servicediscovery/zookeeper/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/assembly/bin/load.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/app.properties b/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/build.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/dev.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/release.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/test.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/dev.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/release.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/test.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/dev.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/release.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/test.sh b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/log.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/server.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..56e309c
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/dev/server.yml
@@ -0,0 +1,75 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "zk-dis"
+ name_mapping: "in-memory"
+ metadata: "default"
+
+remote:
+ zk1:
+ address: "127.0.0.1:2181"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "zookeeper"
+ remote_ref: "zk1"
+
+service_discovery:
+ zk-dis:
+ protocol: "zookeeper"
+ remote_ref: "zk1"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/log.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/server.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/release/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/log.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/server.yml b/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..aa4fb20
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/go-server/profiles/test/server.yml
@@ -0,0 +1,79 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization: "ikurento.com"
+ name: "user-info-server"
+ module: "dubbogo user-info server"
+ version: "0.0.1"
+ owner: "ZX"
+ environment: "dev"
+ metadataType: "local"
+
+
+registries:
+ "demoServiceDiscovery":
+ protocol: "service-discovery"
+ params:
+ service_discovery: "nacos1"
+ name_mapping: "dynamic"
+ metadata: "default"
+
+remote:
+ nacos:
+ address: "127.0.0.1:8848"
+ timeout: "5s"
+
+metadata_report:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+service_discovery:
+ nacos1:
+ protocol: "nacos"
+ remote_ref: "nacos"
+
+config_center:
+ protocol: "nacos"
+ address: "127.0.0.1:8848"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoServiceDiscovery"
+ protocol: "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024000
+ session_name: "server"
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/build.sh b/golang/registry/servicediscovery/zookeeper/java-client/build.sh
new file mode 100755
index 0000000..c869acf
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/build.sh
@@ -0,0 +1,21 @@
+#!/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/golang/registry/servicediscovery/zookeeper/java-client/pom.xml b/golang/registry/servicediscovery/zookeeper/java-client/pom.xml
new file mode 100755
index 0000000..5fc8342
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/pom.xml
@@ -0,0 +1,131 @@
+<?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>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+<!-- <dependency>-->
+<!-- <groupId>com.alibaba.nacos</groupId>-->
+<!-- <artifactId>nacos-client</artifactId>-->
+<!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/settings.xml b/golang/registry/servicediscovery/zookeeper/java-client/settings.xml
new file mode 100644
index 0000000..68d689e
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/settings.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>apache</id>
+ <repositories>
+ <repository>
+ <id>apache.snapshots.https</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>https://repository.apache.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>apache.releases.https</id>
+ <name>Apache Release Distribution Repository</name>
+ <url>https://repository.apache.org/service/local/staging/deploy/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>apache</activeProfile>
+ </activeProfiles>
+</settings>
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/zookeeper/java-client/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..bc00a06
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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/resources</directory>
+ <includes>
+ <include>dubbo.properties</include>
+ <include>log4j.*</include>
+ </includes>
+ <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/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/Consumer.java b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/Consumer.java
new file mode 100755
index 0000000..b3b4b23
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/Consumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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 Consumer {
+ public static void main(String[] args) {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml");
+ context.start();
+ UserProvider userProvider = context.getBean("demoService", UserProvider.class);
+// try {
+// Thread.sleep(100000);
+// } catch (Exception e) {
+// }
+ User hello = userProvider.GetUser("mindeng");
+ System.out.println("result: " + hello);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..666e904
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Date;
+
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..67a836a
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+package com.ikurento.user;
+
+public interface UserProvider {
+ User GetUser(String userId);
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
new file mode 100755
index 0000000..d3b2c46
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
@@ -0,0 +1,41 @@
+<?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="dubbo" name="dubbo" />-->
+<!-- <dubbo:protocol id="jsonrpc" name="jsonrpc" />-->
+
+ <dubbo:registry address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <!-- 声明需要使用的服务接口 -->
+<!-- <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="">-->
+ <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
+<!-- </dubbo:reference>-->
+
+ <dubbo:reference id="demoService" check="false" interface="com.ikurento.user.UserProvider" provided-by="BDTService"/>
+</beans>
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/service.xml b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/service.xml
new file mode 100755
index 0000000..563b838
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/META-INF/spring/service.xml
@@ -0,0 +1,27 @@
+<?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>-->
+
+</beans>
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e561efc
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/dubbo.properties
@@ -0,0 +1,13 @@
+### 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 = dubbo
+
+dubbo.log4j.file = logs/client.log
+dubbo.log4j.level = WARN
diff --git a/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/log4j.properties b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/log4j.properties
new file mode 100755
index 0000000..de4da25
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-client/src/main/resources/log4j.properties
@@ -0,0 +1,19 @@
+## Logger configure file for myproject
+log.dir=logs/
+datestamp=yyyy-MM-dd/HH:mm:ss.SSS
+
+log4j.rootLogger=INFO, file, console
+
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.threshold=INFO
+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/golang/registry/servicediscovery/zookeeper/java-server/build.sh b/golang/registry/servicediscovery/zookeeper/java-server/build.sh
new file mode 100755
index 0000000..7b5755b
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/build.sh
@@ -0,0 +1,20 @@
+#!/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/golang/registry/servicediscovery/zookeeper/java-server/pom.xml b/golang/registry/servicediscovery/zookeeper/java-server/pom.xml
new file mode 100755
index 0000000..bd351cc
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/pom.xml
@@ -0,0 +1,198 @@
+<?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.6.5</dubbo-version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ <dubbo.configcenter.zookeeper.version>2.7.4</dubbo.configcenter.zookeeper.version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo.version>2.7.6</dubbo.version>
+ </properties>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-multicast</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>com.alibaba.nacos</groupId>-->
+ <!-- <artifactId>nacos-client</artifactId>-->
+ <!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-metadata-report-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-config-spring</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-remoting-netty4</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${dubbo.version}</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>
+ </repositories>
+
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>nexus-aliyu</id>
+ <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.alibaba</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>
+ <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/golang/registry/servicediscovery/zookeeper/java-server/script/debug.sh b/golang/registry/servicediscovery/zookeeper/java-server/script/debug.sh
new file mode 100755
index 0000000..851957a
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/script/debug.sh
@@ -0,0 +1,23 @@
+#!/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/golang/registry/servicediscovery/zookeeper/java-server/src/main/assembly/assembly.xml b/golang/registry/servicediscovery/zookeeper/java-server/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..5b4075c
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/assembly/assembly.xml
@@ -0,0 +1,44 @@
+<?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>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</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/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/Provider.java b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/Provider.java
new file mode 100755
index 0000000..8fb3685
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/Provider.java
@@ -0,0 +1,28 @@
+/*
+ * 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 {
+
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider.xml");
+ context.start();
+ System.in.read();
+ }
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/User.java b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..fd2cafb
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,86 @@
+/*
+ * 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.util.Date;
+import java.io.Serializable;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
+ }
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProvider.java b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..b1eeab8
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface UserProvider {
+
+ User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
+
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
new file mode 100755
index 0000000..0d66c43
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProviderImpl implements UserProvider {
+ private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
+
+ public User GetUser(String userId) {
+ return new User(userId, "zhangsan", 18);
+ }
+
+}
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
new file mode 100755
index 0000000..2f89e0d
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -0,0 +1,39 @@
+<?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:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" />
+ <!-- 声明需要暴露的服务接口 -->
+<!-- <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/>-->
+
+ <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
+
+
+ <!-- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>-->
+ <dubbo:registry id="nacos" address="nacos://127.0.0.1:8848?registry-type=service"/>
+
+ <dubbo:protocol name="dubbo"/>
+
+ <dubbo:service registry="nacos" interface="com.ikurento.user.UserProvider" ref="demoService" weight="12"/>
+
+</beans>
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/dubbo.properties b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/dubbo.properties
diff --git a/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/log4j.properties b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/log4j.properties
new file mode 100755
index 0000000..13c8049
--- /dev/null
+++ b/golang/registry/servicediscovery/zookeeper/java-server/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+## 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/golang/router/condition/README.md b/golang/router/condition/README.md
new file mode 100644
index 0000000..84be194
--- /dev/null
+++ b/golang/router/condition/README.md
@@ -0,0 +1,33 @@
+## 1.Run java server & java client following
+
+[README](https://github.com/dubbogo/dubbogo-samples/blob/master/README.md)(You must run java program to initialize configuration in zookeeper)
+
+## 2.Use condition router feature
+
+### 2.1.with config file
+
+Modify [router_config.yml](go-client/profiles/dev/router_config.yml) what you want to config
+
+[How to write router_config.yml](http://dubbo.apache.org/en-us/docs/user/demos/routing-rule.html)
+
+### 2.2.with config center
+
+#### zookeeper
+
+Use [dubbo-admin](https://github.com/apache/dubbo-admin) to set condition router file.
+
+Must set config center item in client.yml for load router file. like
+```
+config_center:
+ protocol: "zookeeper"
+ address: "127.0.0.1:2181"
+```
+
+Make sure dubbo-admin, dubbo-server and dubbo-client use the same zookeeper.
+
+## 3.go client
+
+Then start dubbo-go client following [README](https://github.com/dubbogo/dubbogo-samples/blob/master/README.md).
+
+to check your router, enjoy it.
+
diff --git a/golang/router/condition/go-client/app/client.go b/golang/router/condition/go-client/app/client.go
new file mode 100644
index 0000000..706e348
--- /dev/null
+++ b/golang/router/condition/go-client/app/client.go
@@ -0,0 +1,121 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/cluster/router/condition"
+ _ "github.com/apache/dubbo-go/config_center/zookeeper"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+// export CONF_ROUTER_FILE_PATH="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+ time.Sleep(1e9)
+
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ 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
+ }
+ }
+}
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/router/condition/go-client/assembly/bin/load.sh b/golang/router/condition/go-client/assembly/bin/load.sh
new file mode 100644
index 0000000..ffa240b
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/router/condition/go-client/assembly/common/app.properties b/golang/router/condition/go-client/assembly/common/app.properties
new file mode 100644
index 0000000..e10868f
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/router/condition/go-client/assembly/common/build.sh b/golang/router/condition/go-client/assembly/common/build.sh
new file mode 100644
index 0000000..d38f889
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/router/condition/go-client/assembly/linux/dev.sh b/golang/router/condition/go-client/assembly/linux/dev.sh
new file mode 100644
index 0000000..eada737
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-client/assembly/linux/release.sh b/golang/router/condition/go-client/assembly/linux/release.sh
new file mode 100644
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/router/condition/go-client/assembly/linux/test.sh b/golang/router/condition/go-client/assembly/linux/test.sh
new file mode 100644
index 0000000..78b650c
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/router/condition/go-client/assembly/mac/dev.sh b/golang/router/condition/go-client/assembly/mac/dev.sh
new file mode 100644
index 0000000..c828476
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-client/assembly/mac/release.sh b/golang/router/condition/go-client/assembly/mac/release.sh
new file mode 100644
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/router/condition/go-client/assembly/mac/test.sh b/golang/router/condition/go-client/assembly/mac/test.sh
new file mode 100644
index 0000000..a7853f5
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/router/condition/go-client/assembly/windows/dev.sh b/golang/router/condition/go-client/assembly/windows/dev.sh
new file mode 100644
index 0000000..6487b30
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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="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/golang/router/condition/go-client/assembly/windows/release.sh b/golang/router/condition/go-client/assembly/windows/release.sh
new file mode 100644
index 0000000..21af573
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/router/condition/go-client/assembly/windows/test.sh b/golang/router/condition/go-client/assembly/windows/test.sh
new file mode 100644
index 0000000..2104da8
--- /dev/null
+++ b/golang/router/condition/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/router/condition/go-client/profiles/dev/client.yml b/golang/router/condition/go-client/profiles/dev/client.yml
new file mode 100644
index 0000000..7701c68
--- /dev/null
+++ b/golang/router/condition/go-client/profiles/dev/client.yml
@@ -0,0 +1,62 @@
+# 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 user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ 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/golang/router/condition/go-client/profiles/dev/log.yml b/golang/router/condition/go-client/profiles/dev/log.yml
new file mode 100644
index 0000000..3ed242d
--- /dev/null
+++ b/golang/router/condition/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/router/condition/go-client/profiles/dev/router_config.yml b/golang/router/condition/go-client/profiles/dev/router_config.yml
new file mode 100644
index 0000000..c2c72dd
--- /dev/null
+++ b/golang/router/condition/go-client/profiles/dev/router_config.yml
@@ -0,0 +1,4 @@
+# dubbo router yaml configure file
+priority: 1
+force: true
+conditions : ["host = 192.168.199.208 => host = 192.168.199.208 "]
\ No newline at end of file
diff --git a/golang/router/condition/go-server/app/server.go b/golang/router/condition/go-server/app/server.go
new file mode 100644
index 0000000..3cae749
--- /dev/null
+++ b/golang/router/condition/go-server/app/server.go
@@ -0,0 +1,78 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ _ "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/config_center/zookeeper"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/router/condition/go-server/app/user.go b/golang/router/condition/go-server/app/user.go
new file mode 100644
index 0000000..6410074
--- /dev/null
+++ b/golang/router/condition/go-server/app/user.go
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/router/condition/go-server/assembly/bin/load.sh b/golang/router/condition/go-server/assembly/bin/load.sh
new file mode 100644
index 0000000..90077c2
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/router/condition/go-server/assembly/common/app.properties b/golang/router/condition/go-server/assembly/common/app.properties
new file mode 100644
index 0000000..1f0827e
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/router/condition/go-server/assembly/common/build.sh b/golang/router/condition/go-server/assembly/common/build.sh
new file mode 100644
index 0000000..d90d026
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/router/condition/go-server/assembly/linux/dev.sh b/golang/router/condition/go-server/assembly/linux/dev.sh
new file mode 100644
index 0000000..d830ac9
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/linux/release.sh b/golang/router/condition/go-server/assembly/linux/release.sh
new file mode 100644
index 0000000..9930380
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/linux/test.sh b/golang/router/condition/go-server/assembly/linux/test.sh
new file mode 100644
index 0000000..87144bb
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/mac/dev.sh b/golang/router/condition/go-server/assembly/mac/dev.sh
new file mode 100644
index 0000000..3a7659b
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/mac/release.sh b/golang/router/condition/go-server/assembly/mac/release.sh
new file mode 100644
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/mac/test.sh b/golang/router/condition/go-server/assembly/mac/test.sh
new file mode 100644
index 0000000..69206e3
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/windows/dev.sh b/golang/router/condition/go-server/assembly/windows/dev.sh
new file mode 100644
index 0000000..011fb41
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/windows/release.sh b/golang/router/condition/go-server/assembly/windows/release.sh
new file mode 100644
index 0000000..679a26a
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/assembly/windows/test.sh b/golang/router/condition/go-server/assembly/windows/test.sh
new file mode 100644
index 0000000..4a36de0
--- /dev/null
+++ b/golang/router/condition/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/router/condition/go-server/profiles/dev/log.yml b/golang/router/condition/go-server/profiles/dev/log.yml
new file mode 100644
index 0000000..3ed242d
--- /dev/null
+++ b/golang/router/condition/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/router/condition/go-server/profiles/dev/server.yml b/golang/router/condition/go-server/profiles/dev/server.yml
new file mode 100644
index 0000000..d8245de
--- /dev/null
+++ b/golang/router/condition/go-server/profiles/dev/server.yml
@@ -0,0 +1,92 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ # 对应java配置中address属性的zookeeper <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "dubbo"
+ version: "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "dubbo"
+ version: "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ # ip : "127.0.0.1"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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: 1024
+ session_name: "server"
diff --git a/golang/router/condition/java-client/build.sh b/golang/router/condition/java-client/build.sh
new file mode 100644
index 0000000..c869acf
--- /dev/null
+++ b/golang/router/condition/java-client/build.sh
@@ -0,0 +1,21 @@
+#!/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/golang/router/condition/java-client/pom.xml b/golang/router/condition/java-client/pom.xml
new file mode 100644
index 0000000..ce2d151
--- /dev/null
+++ b/golang/router/condition/java-client/pom.xml
@@ -0,0 +1,211 @@
+<?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>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>2.7.3</dubbo.version>
+ <spring.version>4.3.16.RELEASE</spring.version>
+ <junit.version>4.12</junit.version>
+ <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+ <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
+ <image.name>${artifactId}:${dubbo.version}</image.name>
+ <java-image.name>openjdk:8</java-image.name>
+ <dubbo.port>20880</dubbo.port>
+ <zookeeper.port>2181</zookeeper.port>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-configcenter-apollo</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>dubbo-integration-test</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-maven-address-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>local-address</goal>
+ </goals>
+ <configuration>
+ <localAddress>dubbo-local-address</localAddress>
+ </configuration>
+ <phase>initialize</phase>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>${jib-maven-plugin.version}</version>
+ <configuration>
+ <from>
+ <image>${java-image.name}</image>
+ </from>
+ <to>
+ <image>${image.name}</image>
+ </to>
+ <container>
+ <mainClass>${main-class}</mainClass>
+ <ports>
+ <port>${dubbo.port}</port>
+ <port>${zookeeper.port}</port>
+ </ports>
+ <environment>
+ <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+ </environment>
+ <jvmFlags>
+ <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
+ </jvmFlags>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>dockerBuild</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <run>
+ <ports>
+ <port>${dubbo.port}:${dubbo.port}</port>
+ <port>${zookeeper.port}:${zookeeper.port}</port>
+ </ports>
+ <wait>
+ <log>dubbo service started</log>
+ </wait>
+ </run>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+ </systemPropertyVariables>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/golang/router/condition/java-client/src/main/assembly/assembly.xml b/golang/router/condition/java-client/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..84f5499
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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/resources</directory>
+ <includes>
+ <include>dubbo.properties</include>
+ <include>log4j.*</include>
+ </includes>
+ <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/golang/router/condition/java-client/src/main/java/com/ikurento/user/Consumer.java b/golang/router/condition/java-client/src/main/java/com/ikurento/user/Consumer.java
new file mode 100644
index 0000000..6abfb93
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/java/com/ikurento/user/Consumer.java
@@ -0,0 +1,61 @@
+/*
+ * 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 org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public class Consumer {
+ // Define a private variable (Required in Spring)
+ private UserProvider userProvider;
+
+ // Spring DI (Required in Spring)
+ public void setUserProvider(UserProvider u) {
+ this.userProvider = u;
+ }
+
+ public static void main(String[] args) throws Exception {
+// new EmbeddedZooKeeper(2181, false).start();
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml","META-INF/spring/service.xml");
+ context.start();
+ context.getBean(Consumer.class).start();
+ }
+
+ // Start the entry function for consumer (Specified in the configuration file)
+ public void start() {
+ System.out.println("\n\ntest");
+ testGetUser();
+ }
+
+ private void testGetUser() {
+ try {
+ User user1 = userProvider.GetUser("A003");
+ System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
+ " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName()
+ + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
+
+ } catch (Exception e) {
+ System.out.println("*************exception***********");
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/golang/router/condition/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java b/golang/router/condition/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java
new file mode 100644
index 0000000..fb99a0d
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2014 the original author or 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.
+ */
+package com.ikurento.user;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ * <p>
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ * <p>
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+ /**
+ * Logger.
+ */
+ private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+ /**
+ * ZooKeeper client port. This will be determined dynamically upon startup.
+ */
+ private final int clientPort;
+
+ /**
+ * Whether to auto-start. Default is true.
+ */
+ private boolean autoStartup = true;
+
+ /**
+ * Lifecycle phase. Default is 0.
+ */
+ private int phase = 0;
+
+ /**
+ * Thread for running the ZooKeeper server.
+ */
+ private volatile Thread zkServerThread;
+
+ /**
+ * ZooKeeper server.
+ */
+ private volatile ZooKeeperServerMain zkServer;
+
+ /**
+ * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+ */
+ private ErrorHandler errorHandler;
+
+ private boolean daemon = true;
+
+ /**
+ * Construct an EmbeddedZooKeeper with a random port.
+ */
+ public EmbeddedZooKeeper() {
+ clientPort = SocketUtils.findAvailableTcpPort();
+ }
+
+ /**
+ * Construct an EmbeddedZooKeeper with the provided port.
+ *
+ * @param clientPort port for ZooKeeper server to bind to
+ */
+ public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+ this.clientPort = clientPort;
+ this.daemon = daemon;
+ }
+
+ /**
+ * Returns the port that clients should use to connect to this embedded server.
+ *
+ * @return dynamically determined client port
+ */
+ public int getClientPort() {
+ return this.clientPort;
+ }
+
+ /**
+ * Specify whether to start automatically. Default is true.
+ *
+ * @param autoStartup whether to start automatically
+ */
+ public void setAutoStartup(boolean autoStartup) {
+ this.autoStartup = autoStartup;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+
+ /**
+ * Specify the lifecycle phase for the embedded server.
+ *
+ * @param phase the lifecycle phase
+ */
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getPhase() {
+ return this.phase;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isRunning() {
+ return (zkServerThread != null);
+ }
+
+ /**
+ * Start the ZooKeeper server in a background thread.
+ * <p>
+ * Register an error handler via {@link #setErrorHandler} in order to handle
+ * any exceptions thrown during startup or execution.
+ */
+ @Override
+ public synchronized void start() {
+ if (zkServerThread == null) {
+ zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+ zkServerThread.setDaemon(daemon);
+ zkServerThread.start();
+ }
+ }
+
+ /**
+ * Shutdown the ZooKeeper server.
+ */
+ @Override
+ public synchronized void stop() {
+ if (zkServerThread != null) {
+ // The shutdown method is protected...thus this hack to invoke it.
+ // This will log an exception on shutdown; see
+ // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+ try {
+ Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+ shutdown.setAccessible(true);
+ shutdown.invoke(zkServer);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ // It is expected that the thread will exit after
+ // the server is shutdown; this will block until
+ // the shutdown is complete.
+ try {
+ zkServerThread.join(5000);
+ zkServerThread = null;
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+ // abandoning zk thread
+ zkServerThread = null;
+ }
+ }
+ }
+
+ /**
+ * Stop the server if running and invoke the callback when complete.
+ */
+ @Override
+ public void stop(Runnable callback) {
+ stop();
+ callback.run();
+ }
+
+ /**
+ * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+ * is provided, only error-level logging will occur.
+ *
+ * @param errorHandler the {@link ErrorHandler} to be invoked
+ */
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ /**
+ * Runnable implementation that starts the ZooKeeper server.
+ */
+ private class ServerRunnable implements Runnable {
+
+ @Override
+ public void run() {
+ try {
+ Properties properties = new Properties();
+ File file = new File(System.getProperty("java.io.tmpdir")
+ + File.separator + UUID.randomUUID());
+ file.deleteOnExit();
+ properties.setProperty("dataDir", file.getAbsolutePath());
+ properties.setProperty("clientPort", String.valueOf(clientPort));
+
+ QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+ quorumPeerConfig.parseProperties(properties);
+
+ zkServer = new ZooKeeperServerMain();
+ ServerConfig configuration = new ServerConfig();
+ configuration.readFrom(quorumPeerConfig);
+
+ zkServer.runFromConfig(configuration);
+ } catch (Exception e) {
+ if (errorHandler != null) {
+ errorHandler.handleError(e);
+ } else {
+ logger.error("Exception running embedded ZooKeeper", e);
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/golang/router/condition/java-client/src/main/java/com/ikurento/user/User.java b/golang/router/condition/java-client/src/main/java/com/ikurento/user/User.java
new file mode 100644
index 0000000..1526244
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Date;
+
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+}
diff --git a/golang/router/condition/java-client/src/main/java/com/ikurento/user/UserProvider.java b/golang/router/condition/java-client/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100644
index 0000000..f42452d
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+package com.ikurento.user;
+
+public interface UserProvider {
+ User GetUser(String userId);
+}
diff --git a/golang/router/condition/java-client/src/main/java/com/ikurento/user/ZKTools.java b/golang/router/condition/java-client/src/main/java/com/ikurento/user/ZKTools.java
new file mode 100644
index 0000000..65059ec
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/java/com/ikurento/user/ZKTools.java
@@ -0,0 +1,88 @@
+/*
+ * 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.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+
+public class ZKTools {
+ private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");
+ private static CuratorFramework client;
+
+ public static void main(String[] args) throws Exception {
+ generateDubboProperties();
+ }
+
+ public static void generateDubboProperties() {
+ client = CuratorFrameworkFactory.newClient(zookeeperHost + ":2181", 60 * 1000, 60 * 1000,
+ new ExponentialBackoffRetry(1000, 3));
+ client.start();
+
+ generateDubboPropertiesForGlobal();
+ generateDubboPropertiesForConsumer();
+ }
+
+ public static void generateDubboPropertiesForGlobal() {
+ String str = "dubbo.registry.address=zookeeper://" + zookeeperHost + ":2181\n" +
+// "dubbo.metadata-report.address=zookeeper://" + zookeeperHost + ":2181\n" +
+ "dubbo.protocol.port=-1\n" +
+// "dubbo.registry.simplified=true\n"+
+ "";
+
+ System.out.println(str);
+
+ try {
+ String path = "/dubbo/config/dubbo/dubbo.properties";
+ if (client.checkExists().forPath(path) == null) {
+ client.create().creatingParentsIfNeeded().forPath(path);
+ }
+ setData(path, str);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void generateDubboPropertiesForConsumer() {
+ String str = "dubbo.consumer.timeout=6666\n" +
+ "dubbo.reference.com.ikurento.user.UserProvider.cluster=failback";
+
+ System.out.println(str);
+
+ try {
+ String path = "/dubbo/config/user-info-client/dubbo.properties";
+ if (client.checkExists().forPath(path) == null) {
+ client.create().creatingParentsIfNeeded().forPath(path);
+ }
+ setData(path, str);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void createNode(String path) throws Exception {
+ client.create().forPath(path);
+ }
+
+ private static void deleteNode(String path) throws Exception {
+ client.delete().forPath(path);
+ }
+
+ private static void setData(String path, String data) throws Exception {
+ client.setData().forPath(path, data.getBytes());
+ }
+}
diff --git a/golang/router/condition/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/golang/router/condition/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
new file mode 100644
index 0000000..75e6fec
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
@@ -0,0 +1,37 @@
+<?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="dubbo" name="dubbo" />
+ <dubbo:protocol id="jsonrpc" name="jsonrpc" />
+
+ <!-- 声明需要使用的服务接口 -->
+ <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="com.ikurento.user.UserProvider">
+ <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
+ </dubbo:reference>
+</beans>
diff --git a/golang/router/condition/java-client/src/main/resources/META-INF/spring/service.xml b/golang/router/condition/java-client/src/main/resources/META-INF/spring/service.xml
new file mode 100644
index 0000000..e4f5fda
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/resources/META-INF/spring/service.xml
@@ -0,0 +1,27 @@
+<?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>
+
+</beans>
diff --git a/golang/router/condition/java-client/src/main/resources/log4j.properties b/golang/router/condition/java-client/src/main/resources/log4j.properties
new file mode 100644
index 0000000..06bcb34
--- /dev/null
+++ b/golang/router/condition/java-client/src/main/resources/log4j.properties
@@ -0,0 +1,19 @@
+## 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/golang/router/condition/java-server/build.sh b/golang/router/condition/java-server/build.sh
new file mode 100644
index 0000000..7b5755b
--- /dev/null
+++ b/golang/router/condition/java-server/build.sh
@@ -0,0 +1,20 @@
+#!/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/golang/router/condition/java-server/pom.xml b/golang/router/condition/java-server/pom.xml
new file mode 100644
index 0000000..310c617
--- /dev/null
+++ b/golang/router/condition/java-server/pom.xml
@@ -0,0 +1,210 @@
+<?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>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>2.7.3</dubbo.version>
+ <spring.version>4.3.16.RELEASE</spring.version>
+ <junit.version>4.12</junit.version>
+ <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+ <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
+ <image.name>${artifactId}:${dubbo.version}</image.name>
+ <java-image.name>openjdk:8</java-image.name>
+ <dubbo.port>20880</dubbo.port>
+ <zookeeper.port>2181</zookeeper.port>
+ <main-class>org.apache.dubbo.samples.configcenter.BasicProvider</main-class>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>dubbo-integration-test</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-maven-address-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>local-address</goal>
+ </goals>
+ <configuration>
+ <localAddress>dubbo-local-address</localAddress>
+ </configuration>
+ <phase>initialize</phase>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>${jib-maven-plugin.version}</version>
+ <configuration>
+ <from>
+ <image>${java-image.name}</image>
+ </from>
+ <to>
+ <image>${image.name}</image>
+ </to>
+ <container>
+ <mainClass>${main-class}</mainClass>
+ <ports>
+ <port>${dubbo.port}</port>
+ <port>${zookeeper.port}</port>
+ </ports>
+ <environment>
+ <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+ </environment>
+ <jvmFlags>
+ <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
+ </jvmFlags>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>dockerBuild</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <run>
+ <ports>
+ <port>${dubbo.port}:${dubbo.port}</port>
+ <port>${zookeeper.port}:${zookeeper.port}</port>
+ </ports>
+ <wait>
+ <log>dubbo service started</log>
+ </wait>
+ </run>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+ </systemPropertyVariables>
+ <includes>
+ <include>**/*IT.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
+
diff --git a/golang/router/condition/java-server/script/debug.sh b/golang/router/condition/java-server/script/debug.sh
new file mode 100644
index 0000000..851957a
--- /dev/null
+++ b/golang/router/condition/java-server/script/debug.sh
@@ -0,0 +1,23 @@
+#!/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/golang/router/condition/java-server/src/main/assembly/assembly.xml b/golang/router/condition/java-server/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..ce8e7e7
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <includes>
+ <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/golang/router/condition/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java
new file mode 100644
index 0000000..fb99a0d
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/EmbeddedZooKeeper.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2014 the original author or 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.
+ */
+package com.ikurento.user;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ * <p>
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ * <p>
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+ /**
+ * Logger.
+ */
+ private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+ /**
+ * ZooKeeper client port. This will be determined dynamically upon startup.
+ */
+ private final int clientPort;
+
+ /**
+ * Whether to auto-start. Default is true.
+ */
+ private boolean autoStartup = true;
+
+ /**
+ * Lifecycle phase. Default is 0.
+ */
+ private int phase = 0;
+
+ /**
+ * Thread for running the ZooKeeper server.
+ */
+ private volatile Thread zkServerThread;
+
+ /**
+ * ZooKeeper server.
+ */
+ private volatile ZooKeeperServerMain zkServer;
+
+ /**
+ * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+ */
+ private ErrorHandler errorHandler;
+
+ private boolean daemon = true;
+
+ /**
+ * Construct an EmbeddedZooKeeper with a random port.
+ */
+ public EmbeddedZooKeeper() {
+ clientPort = SocketUtils.findAvailableTcpPort();
+ }
+
+ /**
+ * Construct an EmbeddedZooKeeper with the provided port.
+ *
+ * @param clientPort port for ZooKeeper server to bind to
+ */
+ public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+ this.clientPort = clientPort;
+ this.daemon = daemon;
+ }
+
+ /**
+ * Returns the port that clients should use to connect to this embedded server.
+ *
+ * @return dynamically determined client port
+ */
+ public int getClientPort() {
+ return this.clientPort;
+ }
+
+ /**
+ * Specify whether to start automatically. Default is true.
+ *
+ * @param autoStartup whether to start automatically
+ */
+ public void setAutoStartup(boolean autoStartup) {
+ this.autoStartup = autoStartup;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+
+ /**
+ * Specify the lifecycle phase for the embedded server.
+ *
+ * @param phase the lifecycle phase
+ */
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getPhase() {
+ return this.phase;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isRunning() {
+ return (zkServerThread != null);
+ }
+
+ /**
+ * Start the ZooKeeper server in a background thread.
+ * <p>
+ * Register an error handler via {@link #setErrorHandler} in order to handle
+ * any exceptions thrown during startup or execution.
+ */
+ @Override
+ public synchronized void start() {
+ if (zkServerThread == null) {
+ zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+ zkServerThread.setDaemon(daemon);
+ zkServerThread.start();
+ }
+ }
+
+ /**
+ * Shutdown the ZooKeeper server.
+ */
+ @Override
+ public synchronized void stop() {
+ if (zkServerThread != null) {
+ // The shutdown method is protected...thus this hack to invoke it.
+ // This will log an exception on shutdown; see
+ // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+ try {
+ Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+ shutdown.setAccessible(true);
+ shutdown.invoke(zkServer);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ // It is expected that the thread will exit after
+ // the server is shutdown; this will block until
+ // the shutdown is complete.
+ try {
+ zkServerThread.join(5000);
+ zkServerThread = null;
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+ // abandoning zk thread
+ zkServerThread = null;
+ }
+ }
+ }
+
+ /**
+ * Stop the server if running and invoke the callback when complete.
+ */
+ @Override
+ public void stop(Runnable callback) {
+ stop();
+ callback.run();
+ }
+
+ /**
+ * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+ * is provided, only error-level logging will occur.
+ *
+ * @param errorHandler the {@link ErrorHandler} to be invoked
+ */
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ /**
+ * Runnable implementation that starts the ZooKeeper server.
+ */
+ private class ServerRunnable implements Runnable {
+
+ @Override
+ public void run() {
+ try {
+ Properties properties = new Properties();
+ File file = new File(System.getProperty("java.io.tmpdir")
+ + File.separator + UUID.randomUUID());
+ file.deleteOnExit();
+ properties.setProperty("dataDir", file.getAbsolutePath());
+ properties.setProperty("clientPort", String.valueOf(clientPort));
+
+ QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+ quorumPeerConfig.parseProperties(properties);
+
+ zkServer = new ZooKeeperServerMain();
+ ServerConfig configuration = new ServerConfig();
+ configuration.readFrom(quorumPeerConfig);
+
+ zkServer.runFromConfig(configuration);
+ } catch (Exception e) {
+ if (errorHandler != null) {
+ errorHandler.handleError(e);
+ } else {
+ logger.error("Exception running embedded ZooKeeper", e);
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider.java
new file mode 100644
index 0000000..12845fb
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider.java
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+import java.util.concurrent.CountDownLatch;
+
+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 {
+ new EmbeddedZooKeeper(2181, false).start();
+
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider.xml");
+ context.registerShutdownHook();
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider2.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider2.java
new file mode 100644
index 0000000..1c0a92c
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/Provider2.java
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Provider2 {
+
+ /**
+ * 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 {
+ new EmbeddedZooKeeper(2181, false).start();
+
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.provider2.xml");
+ context.registerShutdownHook();
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/User.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/User.java
new file mode 100644
index 0000000..ac046bd
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,86 @@
+/*
+ * 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.util.Date;
+import java.io.Serializable;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
+ }
+}
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/UserProvider.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100644
index 0000000..831588d
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface UserProvider {
+
+ User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
+
+}
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/ZKTools.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/ZKTools.java
new file mode 100644
index 0000000..6ed90de
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/ZKTools.java
@@ -0,0 +1,89 @@
+/*
+ * 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.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+
+public class ZKTools {
+ private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");
+ private static CuratorFramework client;
+
+ public static void main(String[] args) throws Exception {
+ generateDubboProperties();
+ }
+
+ public static void generateDubboProperties() {
+ client = CuratorFrameworkFactory.newClient(zookeeperHost + ":2181", 60 * 1000, 60 * 1000,
+ new ExponentialBackoffRetry(1000, 3));
+ client.start();
+
+ generateDubboPropertiesForGlobal();
+ generateDubboPropertiesForApp();
+ }
+
+ public static void generateDubboPropertiesForGlobal() {
+ String str = "dubbo.registry.address=zookeeper://" + zookeeperHost + ":2181\n" +
+// "dubbo.metadata-report.address=zookeeper://" + zookeeperHost + ":2181\n" +
+ "dubbo.protocol.port=-1\n" +
+// "dubbo.registry.simplified=true\n"+
+ "";
+
+ System.out.println(str);
+
+ try {
+ String path = "/dubbo/config/dubbo/dubbo.properties";
+ if (client.checkExists().forPath(path) == null) {
+ client.create().creatingParentsIfNeeded().forPath(path);
+ }
+ setData(path, str);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void generateDubboPropertiesForApp() {
+ String str = "dubbo.provider.timeout=6666\n" +
+ "dubbo.application.qos.port=33333\n" +
+ "dubbo.service.com.ikurento.user.UserProvider.cluster=failback";
+
+ System.out.println(str);
+
+ try {
+ String path = "/dubbo/config/user-info-server/dubbo.properties";
+ if (client.checkExists().forPath(path) == null) {
+ client.create().creatingParentsIfNeeded().forPath(path);
+ }
+ setData(path, str);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void createNode(String path) throws Exception {
+ client.create().forPath(path);
+ }
+
+ private static void deleteNode(String path) throws Exception {
+ client.delete().forPath(path);
+ }
+
+ private static void setData(String path, String data) throws Exception {
+ client.setData().forPath(path, data.getBytes());
+ }
+}
diff --git a/golang/router/condition/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java b/golang/router/condition/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java
new file mode 100644
index 0000000..0caf910
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/java/com/ikurento/user/impl/UserProviderImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.impl;
+
+import com.ikurento.user.User;
+import com.ikurento.user.UserProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProviderImpl implements UserProvider {
+ private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
+
+ public User GetUser(String userId) {
+ return new User(userId, "zhangsan", 18);
+ }
+
+}
diff --git a/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
new file mode 100644
index 0000000..5410ef3
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -0,0 +1,34 @@
+<?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协议在20880端口暴露服务 -->
+ <!-- dubbo:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010"/>
+ <!-- 声明需要暴露的服务接口 -->
+ <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider"
+ ref="demoService"/>
+
+ <bean id="demoService" class="com.ikurento.user.impl.UserProviderImpl"/>
+
+</beans>
diff --git a/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider2.xml b/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider2.xml
new file mode 100644
index 0000000..7117b95
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/resources/META-INF/spring/dubbo.provider2.xml
@@ -0,0 +1,34 @@
+<?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协议在20880端口暴露服务 -->
+ <!-- dubbo:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20011"/>
+ <!-- 声明需要暴露的服务接口 -->
+ <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider"
+ ref="demoService"/>
+
+ <bean id="demoService" class="com.ikurento.user.impl.UserProviderImpl"/>
+
+</beans>
diff --git a/golang/router/condition/java-server/src/main/resources/log4j.properties b/golang/router/condition/java-server/src/main/resources/log4j.properties
new file mode 100644
index 0000000..806e33d
--- /dev/null
+++ b/golang/router/condition/java-server/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+## 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/golang/tracing/dubbo/go-client/app/client.go b/golang/tracing/dubbo/go-client/app/client.go
new file mode 100755
index 0000000..f714935
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/app/client.go
@@ -0,0 +1,122 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+ zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
+ "github.com/openzipkin/zipkin-go"
+ zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "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/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+
+ initZipkin()
+ println("\n\n\nstart to test dubbo")
+ user := &User{}
+ span, ctx := opentracing.StartSpanFromContext(context.Background(), "Test-Client-Service")
+ err := userProvider.GetUser(ctx, []interface{}{"A001"}, user)
+ span.Finish()
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v\n", user)
+ 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
+ }
+ }
+}
+
+func initZipkin() {
+ // set up a span reporter
+ reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
+
+ // create our local service endpoint
+ endpoint, err := zipkin.NewEndpoint("myService", "myservice.mydomain.com:80")
+ if err != nil {
+ logger.Errorf("unable to create local endpoint: %+v\n", err)
+ }
+
+ // initialize our tracer
+ nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
+ if err != nil {
+ logger.Errorf("unable to create tracer: %+v\n", err)
+ }
+
+ // use zipkin-go-opentracing to wrap our tracer
+ tracer := zipkinot.Wrap(nativeTracer)
+
+ // optionally set as Global OpenTracing tracer instance
+ opentracing.SetGlobalTracer(tracer)
+}
diff --git a/golang/tracing/dubbo/go-client/app/user.go b/golang/tracing/dubbo/go-client/app/user.go
new file mode 100755
index 0000000..ff4486f
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/app/user.go
@@ -0,0 +1,54 @@
+/*
+ * 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
+
+import (
+ "context"
+ "time"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+var userProvider = new(UserProvider)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+ GetUser func(ctx context.Context, req []interface{}, rsp *User) error
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
diff --git a/golang/tracing/dubbo/go-client/app/version.go b/golang/tracing/dubbo/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/dubbo/go-client/assembly/bin/load.sh b/golang/tracing/dubbo/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/common/app.properties b/golang/tracing/dubbo/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/dubbo/go-client/assembly/common/build.sh b/golang/tracing/dubbo/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d38f889
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/linux/dev.sh b/golang/tracing/dubbo/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/linux/release.sh b/golang/tracing/dubbo/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/linux/test.sh b/golang/tracing/dubbo/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/mac/dev.sh b/golang/tracing/dubbo/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/mac/release.sh b/golang/tracing/dubbo/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/mac/test.sh b/golang/tracing/dubbo/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/windows/dev.sh b/golang/tracing/dubbo/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/windows/release.sh b/golang/tracing/dubbo/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/dubbo/go-client/assembly/windows/test.sh b/golang/tracing/dubbo/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/dubbo/go-client/profiles/dev/client.yml b/golang/tracing/dubbo/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..9b1fb31
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/dev/client.yml
@@ -0,0 +1,61 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "demoZk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoZk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 2
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 10240
+ session_name: "client"
diff --git a/golang/tracing/dubbo/go-client/profiles/dev/log.yml b/golang/tracing/dubbo/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/dubbo/go-client/profiles/release/client.yml b/golang/tracing/dubbo/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..bd93a77
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/release/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 2
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 10240
+ session_name: "client"
diff --git a/golang/tracing/dubbo/go-client/profiles/release/log.yml b/golang/tracing/dubbo/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/dubbo/go-client/profiles/test/client.yml b/golang/tracing/dubbo/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..f2200d1
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/test/client.yml
@@ -0,0 +1,59 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+
+protocol_conf:
+ dubbo:
+ reconnect_interval: 0
+ connection_number: 2
+ heartbeat_period: "5s"
+ session_timeout: "180s"
+ 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_rq_size: 1024
+ pkg_wq_size: 512
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 10240
+ session_name: "client"
diff --git a/golang/tracing/dubbo/go-client/profiles/test/log.yml b/golang/tracing/dubbo/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/tracing/dubbo/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/dubbo/go-server/app/server.go b/golang/tracing/dubbo/go-server/app/server.go
new file mode 100755
index 0000000..f2aabd0
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/app/server.go
@@ -0,0 +1,108 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+ zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
+ "github.com/openzipkin/zipkin-go"
+ zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/common/logger"
+ "github.com/apache/dubbo-go/config"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ hessian.RegisterPOJO(&User{})
+ config.Load()
+
+ initZipkin()
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
+
+func initZipkin() {
+ // set up a span reporter
+ reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
+
+ // create our local service endpoint
+ endpoint, err := zipkin.NewEndpoint("myService", "myservice.mydomain.com:80")
+ if err != nil {
+ logger.Errorf("unable to create local endpoint: %+v\n", err)
+ }
+
+ // initialize our tracer
+ nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
+ if err != nil {
+ logger.Errorf("unable to create tracer: %+v\n", err)
+ }
+
+ // use zipkin-go-opentracing to wrap our tracer
+ tracer := zipkinot.Wrap(nativeTracer)
+
+ // optionally set as Global OpenTracing tracer instance
+ opentracing.SetGlobalTracer(tracer)
+}
diff --git a/golang/tracing/dubbo/go-server/app/user.go b/golang/tracing/dubbo/go-server/app/user.go
new file mode 100755
index 0000000..b729ded
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/app/user.go
@@ -0,0 +1,69 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+)
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+ // ------for hessian2------
+ hessian.RegisterPOJO(&User{})
+}
+
+type User struct {
+ Id string
+ Name string
+ Age int32
+ Time time.Time
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
+ println("req:%#v", req)
+ rsp := User{"A001", "Alex Stocks", 18, time.Now()}
+ span, ctx := opentracing.StartSpanFromContext(ctx, "User-Server-Span")
+ time.Sleep(100 * time.Millisecond)
+ span.Finish()
+ println("rsp:%#v", rsp)
+ return &rsp, nil
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+func (u User) JavaClassName() string {
+ return "com.ikurento.user.User"
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/tracing/dubbo/go-server/app/version.go b/golang/tracing/dubbo/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/dubbo/go-server/assembly/bin/load.sh b/golang/tracing/dubbo/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/common/app.properties b/golang/tracing/dubbo/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/dubbo/go-server/assembly/common/build.sh b/golang/tracing/dubbo/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/linux/dev.sh b/golang/tracing/dubbo/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/linux/release.sh b/golang/tracing/dubbo/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/linux/test.sh b/golang/tracing/dubbo/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/mac/dev.sh b/golang/tracing/dubbo/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/mac/release.sh b/golang/tracing/dubbo/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/mac/test.sh b/golang/tracing/dubbo/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/windows/dev.sh b/golang/tracing/dubbo/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/windows/release.sh b/golang/tracing/dubbo/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/assembly/windows/test.sh b/golang/tracing/dubbo/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/dubbo/go-server/profiles/dev/log.yml b/golang/tracing/dubbo/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/dubbo/go-server/profiles/dev/server.yml b/golang/tracing/dubbo/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..1fca5e6
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/dev/server.yml
@@ -0,0 +1,58 @@
+# dubbo server yaml configure file
+
+filter: "tracing"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "demoZk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "demoZk"
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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/golang/tracing/dubbo/go-server/profiles/release/log.yml b/golang/tracing/dubbo/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/dubbo/go-server/profiles/release/server.yml b/golang/tracing/dubbo/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..72a2964
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/release/server.yml
@@ -0,0 +1,62 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ # ip : "127.0.0.1"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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/golang/tracing/dubbo/go-server/profiles/test/log.yml b/golang/tracing/dubbo/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/dubbo/go-server/profiles/test/server.yml b/golang/tracing/dubbo/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..4e101f5
--- /dev/null
+++ b/golang/tracing/dubbo/go-server/profiles/test/server.yml
@@ -0,0 +1,62 @@
+# dubbo server yaml configure file
+
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "dubbo"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ # ip : "127.0.0.1"
+ port: 20000
+
+
+protocol_conf:
+ dubbo:
+ session_number: 700
+ session_timeout: "180s"
+ 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/golang/tracing/dubbo/java-client/build.sh b/golang/tracing/dubbo/java-client/build.sh
new file mode 100755
index 0000000..c869acf
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/build.sh
@@ -0,0 +1,21 @@
+#!/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/golang/tracing/dubbo/java-client/pom.xml b/golang/tracing/dubbo/java-client/pom.xml
new file mode 100755
index 0000000..4065414
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/pom.xml
@@ -0,0 +1,230 @@
+<?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-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ <dubbo-version>2.6.5</dubbo-version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>dubbo-dependencies-bom</artifactId>
+ <version>${dubbo-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.qianmi</groupId>
+ <artifactId>dubbo-rpc-jsonrpc</artifactId>
+ <version>${dubbo-jsonrpc-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-framework</artifactId>
+ <version>2.12.0</version>
+ </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>org.apache.mina</groupId>
+ <artifactId>mina-core</artifactId>
+ <version>1.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.grizzly</groupId>
+ <artifactId>grizzly-core</artifactId>
+ <version>2.1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>1.2.56</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.4.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-api</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>3.4.14</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>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-simple</artifactId>
+ <version>2.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.caucho</groupId>
+ <artifactId>hessian</artifactId>
+ <version>4.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.26</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>redis.clients</groupId>
+ <artifactId>jedis</artifactId>
+ <version>2.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.2.0.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.cache</groupId>
+ <artifactId>cache-api</artifactId>
+ <version>0.4</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.alibaba</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/golang/tracing/dubbo/java-client/src/main/assembly/assembly.xml b/golang/tracing/dubbo/java-client/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..bc00a06
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/assembly/assembly.xml
@@ -0,0 +1,43 @@
+<?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/resources</directory>
+ <includes>
+ <include>dubbo.properties</include>
+ <include>log4j.*</include>
+ </includes>
+ <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/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java
new file mode 100755
index 0000000..51e3d67
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/Consumer.java
@@ -0,0 +1,60 @@
+/*
+ * 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 org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public class Consumer {
+ // Define a private variable (Required in Spring)
+ private UserProvider userProvider;
+
+ // Spring DI (Required in Spring)
+ public void setUserProvider(UserProvider u) {
+ this.userProvider = u;
+ }
+
+ public static void main(String[] args) {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/dubbo.consumer.xml","META-INF/spring/service.xml");
+ context.start();
+ context.getBean(Consumer.class).start();
+ }
+
+ // Start the entry function for consumer (Specified in the configuration file)
+ public void start() {
+ System.out.println("\n\ntest");
+ testGetUser();
+ }
+
+ private void testGetUser() {
+ try {
+ User user1 = userProvider.GetUser("A003");
+ System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
+ " UserInfo, Id:" + user1.getId() + ", name:" + user1.getName()
+ + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
+
+ } catch (Exception e) {
+ System.out.println("*************exception***********");
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/User.java b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..666e904
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,76 @@
+/*
+ * 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.util.Date;
+
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+}
diff --git a/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..67a836a
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+package com.ikurento.user;
+
+public interface UserProvider {
+ User GetUser(String userId);
+}
diff --git a/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml b/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
new file mode 100755
index 0000000..8e8e84d
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
@@ -0,0 +1,37 @@
+<?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="dubbo" name="dubbo" />
+ <dubbo:protocol id="jsonrpc" name="jsonrpc" />
+
+ <!-- 声明需要使用的服务接口 -->
+ <dubbo:reference registry="ikurento" check="false" id="userProvider" protocol="dubbo" interface="com.ikurento.user.UserProvider">
+ <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
+ </dubbo:reference>
+</beans>
diff --git a/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/service.xml b/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/service.xml
new file mode 100755
index 0000000..529f63e
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/resources/META-INF/spring/service.xml
@@ -0,0 +1,27 @@
+<?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>
+
+</beans>
diff --git a/golang/tracing/dubbo/java-client/src/main/resources/dubbo.properties b/golang/tracing/dubbo/java-client/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..e561efc
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/resources/dubbo.properties
@@ -0,0 +1,13 @@
+### 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 = dubbo
+
+dubbo.log4j.file = logs/client.log
+dubbo.log4j.level = WARN
diff --git a/golang/tracing/dubbo/java-client/src/main/resources/log4j.properties b/golang/tracing/dubbo/java-client/src/main/resources/log4j.properties
new file mode 100755
index 0000000..06bcb34
--- /dev/null
+++ b/golang/tracing/dubbo/java-client/src/main/resources/log4j.properties
@@ -0,0 +1,19 @@
+## 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/golang/tracing/dubbo/java-server/build.sh b/golang/tracing/dubbo/java-server/build.sh
new file mode 100755
index 0000000..7b5755b
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/build.sh
@@ -0,0 +1,20 @@
+#!/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/golang/tracing/dubbo/java-server/pom.xml b/golang/tracing/dubbo/java-server/pom.xml
new file mode 100755
index 0000000..962edfd
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/pom.xml
@@ -0,0 +1,196 @@
+<?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.6.5</dubbo-version>
+ <dubbo-jsonrpc-version>1.0.1</dubbo-jsonrpc-version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>dubbo-dependencies-bom</artifactId>
+ <version>${dubbo-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.25</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>dubbo</artifactId>
+ <version>${dubbo-version}</version>
+ <exclusions>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-framework</artifactId>
+ <version>2.12.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.qianmi</groupId>
+ <artifactId>dubbo-rpc-jsonrpc</artifactId>
+ <version>${dubbo-jsonrpc-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.26</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.10.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.10.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>
+
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>nexus-aliyu</id>
+ <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>nexus-aliyu</id>
+ <url>http://maven.aliyun.com/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.alibaba</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>
+ <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/golang/tracing/dubbo/java-server/script/debug.sh b/golang/tracing/dubbo/java-server/script/debug.sh
new file mode 100755
index 0000000..851957a
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/script/debug.sh
@@ -0,0 +1,23 @@
+#!/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/golang/tracing/dubbo/java-server/src/main/assembly/assembly.xml b/golang/tracing/dubbo/java-server/src/main/assembly/assembly.xml
new file mode 100755
index 0000000..5b4075c
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/assembly/assembly.xml
@@ -0,0 +1,44 @@
+<?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>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</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/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java
new file mode 100755
index 0000000..0031f55
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/Provider.java
@@ -0,0 +1,33 @@
+/*
+ * 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/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/User.java b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/User.java
new file mode 100755
index 0000000..fd2cafb
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/User.java
@@ -0,0 +1,86 @@
+/*
+ * 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.util.Date;
+import java.io.Serializable;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time +"}";
+ }
+}
diff --git a/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java
new file mode 100755
index 0000000..b1eeab8
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProvider.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public interface UserProvider {
+
+ User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
+
+}
diff --git a/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
new file mode 100755
index 0000000..0d66c43
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/java/com/ikurento/user/UserProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProviderImpl implements UserProvider {
+ private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); //Output to user-server.log
+
+ public User GetUser(String userId) {
+ return new User(userId, "zhangsan", 18);
+ }
+
+}
diff --git a/golang/tracing/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml b/golang/tracing/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
new file mode 100755
index 0000000..3fca067
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -0,0 +1,33 @@
+<?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协议在20880端口暴露服务 -->
+ <!-- dubbo:protocol host="127.0.0.1" / -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" />
+ <!-- 声明需要暴露的服务接口 -->
+ <dubbo:service id="aaa" registry="ikurento" timeout="3000" interface="com.ikurento.user.UserProvider" ref="demoService"/>
+
+ <bean id="demoService" class="com.ikurento.user.UserProviderImpl" />
+
+</beans>
diff --git a/golang/tracing/dubbo/java-server/src/main/resources/dubbo.properties b/golang/tracing/dubbo/java-server/src/main/resources/dubbo.properties
new file mode 100755
index 0000000..2826f31
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/resources/dubbo.properties
@@ -0,0 +1,14 @@
+### 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 = dubbo
+dubbo.protocol.port = 10000
+
+dubbo.log4j.file = logs/dubbo.log
+dubbo.log4j.level = INFO
diff --git a/golang/tracing/dubbo/java-server/src/main/resources/log4j.properties b/golang/tracing/dubbo/java-server/src/main/resources/log4j.properties
new file mode 100755
index 0000000..13c8049
--- /dev/null
+++ b/golang/tracing/dubbo/java-server/src/main/resources/log4j.properties
@@ -0,0 +1,20 @@
+## 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/golang/tracing/grpc/README.md b/golang/tracing/grpc/README.md
new file mode 100644
index 0000000..1cb0b1f
--- /dev/null
+++ b/golang/tracing/grpc/README.md
@@ -0,0 +1,46 @@
+### 1.Run jaeger with docker
+
+[jaeger-getting-started](https://www.jaegertracing.io/docs/1.17/getting-started/)
+
+use [all-in-one](https://hub.docker.com/r/jaegertracing/all-in-one) image
+
+### 2.Start zookeeper
+
+### 3.Run go server
+
+Set Jaeger ENV variable
+```
+CONF_PROVIDER_FILE_PATH=xxxxxxxxxxxxx
+JAEGER_AGENT_PORT=32769
+JAEGER_AGENT_HOST=localhost
+JAEGER_SERVICE_NAME=GrpcServer
+JAEGER_SAMPLER_PARAM=1
+```
+
+Detail: [jaeger-environment-variables](https://github.com/jaegertracing/jaeger-client-go#environment-variables)
+
+PS:
+* JAEGER_SAMPLER_PARAM must set ```1``` , it means 100% requests will be used for sample. Set ```0.9``` means 90% requests.
+* JAEGER_AGENT_PORT=32769. ```32769``` is docker published port, it map to ```6831```, golang client will use ```6831``` for send tracing data.
+
+Then run go server.
+
+### 4.Run go client
+
+Set Jaeger ENV variable
+```
+CONF_CONSUMER_FILE_PATH=xxxxxxxxxxxxx
+JAEGER_AGENT_PORT=32769
+JAEGER_AGENT_HOST=localhost
+JAEGER_SERVICE_NAME=GrpcClient
+JAEGER_SAMPLER_PARAM=1
+```
+
+Detail: [jaeger-environment-variables](https://github.com/jaegertracing/jaeger-client-go#environment-variables).
+
+Then start go client following [README](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md).
+
+### 5.Check tracing data on Jeager-UI
+
+Open [http://localhost:32768/search](http://localhost:32768/search)
+
diff --git a/golang/tracing/grpc/go-client/app/Makefile b/golang/tracing/grpc/go-client/app/Makefile
new file mode 100644
index 0000000..be60da1
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/Makefile
@@ -0,0 +1,2 @@
+gen:
+ protoc -I ./ helloworld.proto --go_out=plugins=grpc:.
diff --git a/golang/tracing/grpc/go-client/app/client.go b/golang/tracing/grpc/go-client/app/client.go
new file mode 100644
index 0000000..0bdd354
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/client.go
@@ -0,0 +1,109 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "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"
+ _ "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"
+
+ opentracing "github.com/opentracing/opentracing-go"
+ jaegercfg "github.com/uber/jaeger-client-go/config"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ cfg, err := jaegercfg.FromEnv()
+ if err != nil {
+ // parsing errors might happen here, such as when we get a string where we expect a number
+ return
+ }
+
+ tracer, closer, err := cfg.NewTracer()
+ if err != nil {
+ return
+ }
+ defer closer.Close()
+
+ opentracing.SetGlobalTracer(tracer)
+ config.Load()
+ time.Sleep(time.Second)
+
+ println("\n\n\nstart to test dubbo")
+ reply := &HelloReply{}
+ req := &HelloRequest{
+ Name: "xujianhai",
+ }
+ err = grpcGreeterImpl.SayHello(context.TODO(), req, reply)
+ if err != nil {
+ panic(err)
+ }
+ println("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/golang/tracing/grpc/go-client/app/hello.go b/golang/tracing/grpc/go-client/app/hello.go
new file mode 100644
index 0000000..f3e6a8f
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/hello.go
@@ -0,0 +1,48 @@
+/*
+ * 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
+
+import (
+ "context"
+)
+
+import (
+ "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
+}
+
+func (u *GrpcGreeterImpl) Reference() string {
+ return "GrpcGreeterImpl"
+}
+
+func (u *GrpcGreeterImpl) GetDubboStub(cc *grpc.ClientConn) GreeterClient {
+ return NewGreeterClient(cc)
+}
diff --git a/golang/tracing/grpc/go-client/app/helloworld.pb.go b/golang/tracing/grpc/go-client/app/helloworld.pb.go
new file mode 100644
index 0000000..61361f5
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/helloworld.pb.go
@@ -0,0 +1,284 @@
+// 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/golang/tracing/grpc/go-client/app/helloworld.proto b/golang/tracing/grpc/go-client/app/helloworld.proto
new file mode 100644
index 0000000..d68e1dd
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/helloworld.proto
@@ -0,0 +1,37 @@
+// 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/golang/tracing/grpc/go-client/app/version.go b/golang/tracing/grpc/go-client/app/version.go
new file mode 100644
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/grpc/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/grpc/go-client/assembly/bin/load.sh b/golang/tracing/grpc/go-client/assembly/bin/load.sh
new file mode 100644
index 0000000..ffa240b
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/tracing/grpc/go-client/assembly/common/app.properties b/golang/tracing/grpc/go-client/assembly/common/app.properties
new file mode 100644
index 0000000..e10868f
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/grpc/go-client/assembly/common/build.sh b/golang/tracing/grpc/go-client/assembly/common/build.sh
new file mode 100644
index 0000000..d38f889
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/tracing/grpc/go-client/assembly/linux/dev.sh b/golang/tracing/grpc/go-client/assembly/linux/dev.sh
new file mode 100644
index 0000000..eada737
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-client/assembly/linux/release.sh b/golang/tracing/grpc/go-client/assembly/linux/release.sh
new file mode 100644
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/grpc/go-client/assembly/linux/test.sh b/golang/tracing/grpc/go-client/assembly/linux/test.sh
new file mode 100644
index 0000000..78b650c
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/grpc/go-client/assembly/mac/dev.sh b/golang/tracing/grpc/go-client/assembly/mac/dev.sh
new file mode 100644
index 0000000..c828476
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-client/assembly/mac/release.sh b/golang/tracing/grpc/go-client/assembly/mac/release.sh
new file mode 100644
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/grpc/go-client/assembly/mac/test.sh b/golang/tracing/grpc/go-client/assembly/mac/test.sh
new file mode 100644
index 0000000..a7853f5
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/grpc/go-client/assembly/windows/dev.sh b/golang/tracing/grpc/go-client/assembly/windows/dev.sh
new file mode 100644
index 0000000..10a3866
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/grpc/go-client/assembly/windows/release.sh b/golang/tracing/grpc/go-client/assembly/windows/release.sh
new file mode 100644
index 0000000..21af573
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/grpc/go-client/assembly/windows/test.sh b/golang/tracing/grpc/go-client/assembly/windows/test.sh
new file mode 100644
index 0000000..2104da8
--- /dev/null
+++ b/golang/tracing/grpc/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/grpc/go-client/profiles/dev/client.yml b/golang/tracing/grpc/go-client/profiles/dev/client.yml
new file mode 100644
index 0000000..d04a578
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/dev/client.yml
@@ -0,0 +1,61 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+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 :
+ "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_rq_size: 1024
+ 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/golang/tracing/grpc/go-client/profiles/dev/log.yml b/golang/tracing/grpc/go-client/profiles/dev/log.yml
new file mode 100644
index 0000000..3ed242d
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/grpc/go-client/profiles/release/client.yml b/golang/tracing/grpc/go-client/profiles/release/client.yml
new file mode 100644
index 0000000..265654c
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/release/client.yml
@@ -0,0 +1,61 @@
+# dubbo client yaml configure file
+
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+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 :
+ "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_rq_size: 1024
+ 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/golang/tracing/grpc/go-client/profiles/release/log.yml b/golang/tracing/grpc/go-client/profiles/release/log.yml
new file mode 100644
index 0000000..d860624
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/grpc/go-client/profiles/test/client.yml b/golang/tracing/grpc/go-client/profiles/test/client.yml
new file mode 100644
index 0000000..e0c0737
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/test/client.yml
@@ -0,0 +1,63 @@
+# 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/golang/tracing/grpc/go-client/profiles/test/log.yml b/golang/tracing/grpc/go-client/profiles/test/log.yml
new file mode 100644
index 0000000..f93d3c7
--- /dev/null
+++ b/golang/tracing/grpc/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/grpc/go-server/app/greeter.go b/golang/tracing/grpc/go-server/app/greeter.go
new file mode 100644
index 0000000..709e229
--- /dev/null
+++ b/golang/tracing/grpc/go-server/app/greeter.go
@@ -0,0 +1,50 @@
+/*
+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
+
+import (
+ "context"
+ "fmt"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+func init() {
+ config.SetProviderService(NewGreeterProvider())
+}
+
+type GreeterProvider struct {
+ *GreeterProviderBase
+}
+
+func NewGreeterProvider() *GreeterProvider {
+ return &GreeterProvider{
+ GreeterProviderBase: &GreeterProviderBase{},
+ }
+}
+
+func (g *GreeterProvider) SayHello(ctx context.Context, req *HelloRequest) (reply *HelloReply, err error) {
+ fmt.Printf("req: %v", req)
+ return &HelloReply{Message: "this is message from reply"}, nil
+}
+
+func (g *GreeterProvider) Reference() string {
+ return "GrpcGreeterImpl"
+}
diff --git a/golang/tracing/grpc/go-server/app/helloworld.pb.go b/golang/tracing/grpc/go-server/app/helloworld.pb.go
new file mode 100644
index 0000000..61361f5
--- /dev/null
+++ b/golang/tracing/grpc/go-server/app/helloworld.pb.go
@@ -0,0 +1,284 @@
+// 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/golang/tracing/grpc/go-server/app/helloworld.proto b/golang/tracing/grpc/go-server/app/helloworld.proto
new file mode 100644
index 0000000..d68e1dd
--- /dev/null
+++ b/golang/tracing/grpc/go-server/app/helloworld.proto
@@ -0,0 +1,37 @@
+// 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/golang/tracing/grpc/go-server/app/server.go b/golang/tracing/grpc/go-server/app/server.go
new file mode 100644
index 0000000..5abdce4
--- /dev/null
+++ b/golang/tracing/grpc/go-server/app/server.go
@@ -0,0 +1,91 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "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"
+ _ "github.com/apache/dubbo-go/protocol/grpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+
+ opentracing "github.com/opentracing/opentracing-go"
+ jaegercfg "github.com/uber/jaeger-client-go/config"
+)
+
+var (
+ survivalTimeout = int(3 * time.Second)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+ cfg, err := jaegercfg.FromEnv()
+ if err != nil {
+ // parsing errors might happen here, such as when we get a string where we expect a number
+ return
+ }
+
+ tracer, closer, err := cfg.NewTracer()
+ if err != nil {
+ return
+ }
+ defer closer.Close()
+
+ opentracing.SetGlobalTracer(tracer)
+
+ config.Load()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
diff --git a/golang/tracing/grpc/go-server/app/version.go b/golang/tracing/grpc/go-server/app/version.go
new file mode 100644
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/grpc/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/grpc/go-server/assembly/bin/load.sh b/golang/tracing/grpc/go-server/assembly/bin/load.sh
new file mode 100644
index 0000000..90077c2
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/tracing/grpc/go-server/assembly/common/app.properties b/golang/tracing/grpc/go-server/assembly/common/app.properties
new file mode 100644
index 0000000..1f0827e
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/grpc/go-server/assembly/common/build.sh b/golang/tracing/grpc/go-server/assembly/common/build.sh
new file mode 100644
index 0000000..d90d026
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/tracing/grpc/go-server/assembly/linux/dev.sh b/golang/tracing/grpc/go-server/assembly/linux/dev.sh
new file mode 100644
index 0000000..d830ac9
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/linux/release.sh b/golang/tracing/grpc/go-server/assembly/linux/release.sh
new file mode 100644
index 0000000..9930380
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/linux/test.sh b/golang/tracing/grpc/go-server/assembly/linux/test.sh
new file mode 100644
index 0000000..87144bb
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/mac/dev.sh b/golang/tracing/grpc/go-server/assembly/mac/dev.sh
new file mode 100644
index 0000000..3a7659b
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/mac/release.sh b/golang/tracing/grpc/go-server/assembly/mac/release.sh
new file mode 100644
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/mac/test.sh b/golang/tracing/grpc/go-server/assembly/mac/test.sh
new file mode 100644
index 0000000..69206e3
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/windows/dev.sh b/golang/tracing/grpc/go-server/assembly/windows/dev.sh
new file mode 100644
index 0000000..011fb41
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/windows/release.sh b/golang/tracing/grpc/go-server/assembly/windows/release.sh
new file mode 100644
index 0000000..679a26a
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/assembly/windows/test.sh b/golang/tracing/grpc/go-server/assembly/windows/test.sh
new file mode 100644
index 0000000..4a36de0
--- /dev/null
+++ b/golang/tracing/grpc/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/grpc/go-server/profiles/dev/log.yml b/golang/tracing/grpc/go-server/profiles/dev/log.yml
new file mode 100644
index 0000000..3ed242d
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/grpc/go-server/profiles/dev/server.yml b/golang/tracing/grpc/go-server/profiles/dev/server.yml
new file mode 100644
index 0000000..e0677e4
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/dev/server.yml
@@ -0,0 +1,57 @@
+# 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/golang/tracing/grpc/go-server/profiles/release/log.yml b/golang/tracing/grpc/go-server/profiles/release/log.yml
new file mode 100644
index 0000000..d860624
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/grpc/go-server/profiles/release/server.yml b/golang/tracing/grpc/go-server/profiles/release/server.yml
new file mode 100644
index 0000000..214aa14
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/release/server.yml
@@ -0,0 +1,54 @@
+# 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/golang/tracing/grpc/go-server/profiles/test/log.yml b/golang/tracing/grpc/go-server/profiles/test/log.yml
new file mode 100644
index 0000000..f93d3c7
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/grpc/go-server/profiles/test/server.yml b/golang/tracing/grpc/go-server/profiles/test/server.yml
new file mode 100644
index 0000000..da146ad
--- /dev/null
+++ b/golang/tracing/grpc/go-server/profiles/test/server.yml
@@ -0,0 +1,57 @@
+# 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"
+
+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/golang/tracing/jsonrpc/go-client/app/client.go b/golang/tracing/jsonrpc/go-client/app/client.go
new file mode 100755
index 0000000..2839875
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/app/client.go
@@ -0,0 +1,286 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+ zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
+ "github.com/openzipkin/zipkin-go"
+ zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
+)
+
+import (
+ "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/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout int = 10e9
+)
+
+// they are necessary:
+// export CONF_CONSUMER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ config.Load()
+ initZipkin()
+
+ println("\n\n\nstart to test jsonrpc")
+ user := &JsonRPCUser{}
+ ctx := context.WithValue(context.Background(), "MyTracing", "Tracing123")
+ span, spanCtx := opentracing.StartSpanFromContext(ctx, "User-Test-Service")
+ err := userProvider.GetUser(spanCtx, []interface{}{"A003"}, user)
+ span.Finish()
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ initSignal()
+}
+
+func initZipkin() {
+ // set up a span reporter
+ reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
+
+ // create our local service endpoint
+ endpoint, err := zipkin.NewEndpoint("client-service", "myservice.mydomain.com:80")
+ if err != nil {
+ logger.Errorf("unable to create local endpoint: %+v\n", err)
+ }
+
+ // initialize our tracer
+ nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
+ if err != nil {
+ logger.Errorf("unable to create tracer: %+v\n", err)
+ }
+
+ // use zipkin-go-opentracing to wrap our tracer
+ tracer := zipkinot.Wrap(nativeTracer)
+
+ // optionally set as Global OpenTracing tracer instance
+ opentracing.SetGlobalTracer(tracer)
+}
+
+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
+ }
+ }
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
+
+func test() {
+ println("\n\n\necho")
+ res, err := userProvider.Echo(context.TODO(), "OK")
+ if err != nil {
+ println("echo - error: %v", err)
+ } else {
+ println("res: %v", res)
+ }
+
+ time.Sleep(3e9)
+
+ ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
+ println("\n\n\nstart to test jsonrpc - GetUser0")
+ ret, err := userProvider.GetUser0("A003", "Moorse")
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test jsonrpc - GetUsers")
+ ret1, err := userProvider.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test jsonrpc - getUser")
+ user := &JsonRPCUser{}
+ err = userProvider.GetUser2(ctx, []interface{}{1}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test jsonrpc - GetUser3")
+ err = userProvider.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test jsonrpc illegal method")
+ err = userProvider.GetUser1(ctx, []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
+
+func test1() {
+ ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
+ println("\n\n\necho")
+ res, err := userProvider1.Echo(ctx, "OK")
+ if err != nil {
+ println("echo - error: %v", err)
+ } else {
+ println("res: %v", res)
+ }
+
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test jsonrpc")
+ user := &JsonRPCUser{}
+ err = userProvider1.GetUser(ctx, []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test jsonrpc - GetUser0")
+ ret, err := userProvider1.GetUser0("A003", "Moorse")
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test jsonrpc - GetUsers")
+ ret1, err := userProvider1.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test jsonrpc - getUser")
+ user = &JsonRPCUser{}
+ err = userProvider1.GetUser2(ctx, []interface{}{1}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test jsonrpc - GetUser3")
+ err = userProvider1.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test jsonrpc illegal method")
+ err = userProvider1.GetUser1(ctx, []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
+
+func test2() {
+ ctx := context.WithValue(context.Background(), "TracingID", "Tracing123")
+ println("\n\n\necho")
+ res, err := userProvider2.Echo(ctx, "OK")
+ if err != nil {
+ println("echo - error: %v", err)
+ } else {
+ println("res: %v", res)
+ }
+
+ time.Sleep(3e9)
+
+ println("\n\n\nstart to test jsonrpc")
+ user := &JsonRPCUser{}
+ err = userProvider2.GetUser(ctx, []interface{}{"A003"}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test jsonrpc - GetUser0")
+ ret, err := userProvider2.GetUser0("A003", "Moorse")
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret)
+
+ println("\n\n\nstart to test jsonrpc - GetUsers")
+ ret1, err := userProvider2.GetUsers([]interface{}{[]interface{}{"A002", "A003"}})
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", ret1)
+
+ println("\n\n\nstart to test jsonrpc - getUser")
+ user = &JsonRPCUser{}
+ err = userProvider2.GetUser2(ctx, []interface{}{1}, user)
+ if err != nil {
+ panic(err)
+ }
+ println("response result: %v", user)
+
+ println("\n\n\nstart to test jsonrpc - GetUser3")
+ err = userProvider2.GetUser3()
+ if err != nil {
+ panic(err)
+ }
+ println("succ!")
+
+ println("\n\n\nstart to test jsonrpc illegal method")
+ err = userProvider2.GetUser1(ctx, []interface{}{"A003"}, user)
+ if err == nil {
+ panic("err is nil")
+ }
+ println("error: %v", err)
+}
diff --git a/golang/tracing/jsonrpc/go-client/app/user.go b/golang/tracing/jsonrpc/go-client/app/user.go
new file mode 100755
index 0000000..c6fdbe1
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/app/user.go
@@ -0,0 +1,97 @@
+/*
+ * 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
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+)
+
+var (
+ userProvider = new(UserProvider)
+ userProvider1 = new(UserProvider1)
+ userProvider2 = new(UserProvider2)
+)
+
+func init() {
+ config.SetConsumerService(userProvider)
+ config.SetConsumerService(userProvider1)
+ config.SetConsumerService(userProvider2)
+}
+
+type JsonRPCUser struct {
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Age int64 `json:"age"`
+ Time int64 `json:"time"`
+ Sex string `json:"sex"`
+}
+
+func (u JsonRPCUser) String() string {
+ return fmt.Sprintf(
+ "User{ID:%s, Name:%s, Age:%d, Time:%s, Sex:%s}",
+ u.ID, u.Name, u.Age, time.Unix(u.Time, 0).Format("2006-01-02 15:04:05.99999"), u.Sex,
+ )
+}
+
+type UserProvider struct {
+ GetUsers func(req []interface{}) ([]JsonRPCUser, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser0 func(id string, name string) (JsonRPCUser, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
+
+type UserProvider1 struct {
+ GetUsers func(req []interface{}) ([]JsonRPCUser, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser0 func(id string, name string) (JsonRPCUser, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider1) Reference() string {
+ return "UserProvider1"
+}
+
+type UserProvider2 struct {
+ GetUsers func(req []interface{}) ([]JsonRPCUser, error)
+ GetUser func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser0 func(id string, name string) (JsonRPCUser, error)
+ GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+ GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
+ GetUser3 func() error
+ Echo func(ctx context.Context, req interface{}) (interface{}, error) // Echo represent EchoFilter will be used
+}
+
+func (u *UserProvider2) Reference() string {
+ return "UserProvider2"
+}
diff --git a/golang/tracing/jsonrpc/go-client/app/version.go b/golang/tracing/jsonrpc/go-client/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/jsonrpc/go-client/assembly/bin/load.sh b/golang/tracing/jsonrpc/go-client/assembly/bin/load.sh
new file mode 100755
index 0000000..ffa240b
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/bin/load.sh
@@ -0,0 +1,203 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/common/app.properties b/golang/tracing/jsonrpc/go-client/assembly/common/app.properties
new file mode 100755
index 0000000..e10868f
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/jsonrpc/go-client/assembly/common/build.sh b/golang/tracing/jsonrpc/go-client/assembly/common/build.sh
new file mode 100755
index 0000000..d1f7136
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/common/build.sh
@@ -0,0 +1,83 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/linux/dev.sh b/golang/tracing/jsonrpc/go-client/assembly/linux/dev.sh
new file mode 100755
index 0000000..eada737
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/linux/release.sh b/golang/tracing/jsonrpc/go-client/assembly/linux/release.sh
new file mode 100755
index 0000000..10eb3d7
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/linux/release.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/linux/test.sh b/golang/tracing/jsonrpc/go-client/assembly/linux/test.sh
new file mode 100755
index 0000000..78b650c
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/linux/test.sh
@@ -0,0 +1,35 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/mac/dev.sh b/golang/tracing/jsonrpc/go-client/assembly/mac/dev.sh
new file mode 100755
index 0000000..c828476
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/mac/release.sh b/golang/tracing/jsonrpc/go-client/assembly/mac/release.sh
new file mode 100755
index 0000000..91c2dfe
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/mac/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/mac/test.sh b/golang/tracing/jsonrpc/go-client/assembly/mac/test.sh
new file mode 100755
index 0000000..a7853f5
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/mac/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/windows/dev.sh b/golang/tracing/jsonrpc/go-client/assembly/windows/dev.sh
new file mode 100755
index 0000000..10a3866
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/windows/dev.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/windows/release.sh b/golang/tracing/jsonrpc/go-client/assembly/windows/release.sh
new file mode 100755
index 0000000..21af573
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/windows/release.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/jsonrpc/go-client/assembly/windows/test.sh b/golang/tracing/jsonrpc/go-client/assembly/windows/test.sh
new file mode 100755
index 0000000..2104da8
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/assembly/windows/test.sh
@@ -0,0 +1,34 @@
+#!/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/golang/tracing/jsonrpc/go-client/profiles/dev/client.yml b/golang/tracing/jsonrpc/go-client/profiles/dev/client.yml
new file mode 100755
index 0000000..3b00039
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/dev/client.yml
@@ -0,0 +1,62 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+
+filter: "tracing"
diff --git a/golang/tracing/jsonrpc/go-client/profiles/dev/log.yml b/golang/tracing/jsonrpc/go-client/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/jsonrpc/go-client/profiles/release/client.yml b/golang/tracing/jsonrpc/go-client/profiles/release/client.yml
new file mode 100755
index 0000000..48b7ebe
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/release/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
diff --git a/golang/tracing/jsonrpc/go-client/profiles/release/log.yml b/golang/tracing/jsonrpc/go-client/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/jsonrpc/go-client/profiles/test/client.yml b/golang/tracing/jsonrpc/go-client/profiles/test/client.yml
new file mode 100755
index 0000000..78a21ad
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/test/client.yml
@@ -0,0 +1,60 @@
+# dubbo client yaml configure file
+
+check: true
+# client
+request_timeout : "3s"
+# connect timeout
+connect_timeout : "3s"
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info client"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+references:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ interface : "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods :
+ - name: "GetUser"
+ retries: 3
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ version : "2.0"
+ group: "as"
+ interface: "com.ikurento.user.UserProvider"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 3
diff --git a/golang/tracing/jsonrpc/go-client/profiles/test/log.yml b/golang/tracing/jsonrpc/go-client/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-client/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/jsonrpc/go-server/app/server.go b/golang/tracing/jsonrpc/go-server/app/server.go
new file mode 100755
index 0000000..6f32757
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/server.go
@@ -0,0 +1,107 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+ zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
+ "github.com/openzipkin/zipkin-go"
+ zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
+)
+
+import (
+ "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/protocol/jsonrpc"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+
+ _ "github.com/apache/dubbo-go/filter/filter_impl"
+
+ _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+ _ "github.com/apache/dubbo-go/cluster/loadbalance"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+var (
+ survivalTimeout = int(3e9)
+)
+
+// they are necessary:
+// export CONF_PROVIDER_FILE_PATH="xxx"
+// export APP_LOG_CONF_FILE="xxx"
+func main() {
+
+ config.Load()
+
+ initZipkin()
+
+ 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("provider app exit now...")
+ return
+ }
+ }
+}
+
+func initZipkin() {
+ // set up a span reporter
+ reporter := zipkinhttp.NewReporter("http://localhost:9411/api/v2/spans")
+
+ // create our local service endpoint
+ endpoint, err := zipkin.NewEndpoint("myService", "myservice.mydomain.com:80")
+ if err != nil {
+ logger.Errorf("unable to create local endpoint: %+v\n", err)
+ }
+
+ // initialize our tracer
+ nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
+ if err != nil {
+ logger.Errorf("unable to create tracer: %+v\n", err)
+ }
+
+ // use zipkin-go-opentracing to wrap our tracer
+ tracer := zipkinot.Wrap(nativeTracer)
+
+ // optionally set as Global OpenTracing tracer instance
+ opentracing.SetGlobalTracer(tracer)
+}
diff --git a/golang/tracing/jsonrpc/go-server/app/user.go b/golang/tracing/jsonrpc/go-server/app/user.go
new file mode 100755
index 0000000..8376610
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/user.go
@@ -0,0 +1,78 @@
+/*
+ * 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
+
+import (
+ "fmt"
+ "time"
+)
+
+type Gender int
+
+const (
+ MAN = iota
+ WOMAN
+)
+
+var genderStrings = [...]string{
+ "MAN",
+ "WOMAN",
+}
+
+func (g Gender) String() string {
+ return genderStrings[g]
+}
+
+type (
+ User struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Age int `json:"age"`
+ sex Gender
+ Birth int `json:"time"`
+ Sex string `json:"sex"`
+ }
+)
+
+var (
+ DefaultUser = User{
+ Id: "0", Name: "Alex Stocks", Age: 31,
+ // Birth: int(time.Date(1985, time.November, 10, 23, 0, 0, 0, time.UTC).Unix()),
+ Birth: int(time.Date(1985, 11, 24, 15, 15, 0, 0, time.Local).Unix()),
+ sex: Gender(MAN),
+ }
+
+ userMap = make(map[string]User)
+)
+
+func init() {
+ DefaultUser.Sex = DefaultUser.sex.String()
+ userMap["A000"] = DefaultUser
+ userMap["A001"] = User{Id: "001", Name: "ZhangSheng", Age: 18, sex: MAN}
+ userMap["A002"] = User{Id: "002", Name: "Lily", Age: 20, sex: WOMAN}
+ userMap["A003"] = User{Id: "113", Name: "Moorse", Age: 30, sex: MAN}
+ for k, v := range userMap {
+ v.Birth = int(time.Now().AddDate(-1*v.Age, 0, 0).Unix())
+ v.Sex = userMap[k].sex.String()
+ userMap[k] = v
+ }
+}
+
+func println(format string, args ...interface{}) {
+ fmt.Printf("\033[32;40m"+format+"\033[0m\n", args...)
+}
diff --git a/golang/tracing/jsonrpc/go-server/app/user_provider.go b/golang/tracing/jsonrpc/go-server/app/user_provider.go
new file mode 100755
index 0000000..1983dc1
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/user_provider.go
@@ -0,0 +1,111 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+ "time"
+
+ "github.com/opentracing/opentracing-go"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+ perrors "github.com/pkg/errors"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider))
+}
+
+type UserProvider struct {
+}
+
+func (u *UserProvider) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ if ctx == nil {
+ println("ctx is nil %v")
+ ctx = context.Background()
+ }
+ span, _ := opentracing.StartSpanFromContext(ctx, "User-Provider-non")
+ defer span.Finish()
+ println("req:%#v", req)
+ if ctx != nil {
+ println("tracing Id: %v", ctx.Value("TracingId"))
+ }
+ time.Sleep(10 * time.Millisecond)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider) GetUser0(id string, name string) (User, error) {
+ var err error
+
+ println("id:%s, name:%s", id, name)
+ user, err := u.getUser(id)
+ if err != nil {
+ return User{}, err
+ }
+ if user.Name != name {
+ return User{}, perrors.New("name is not " + user.Name)
+ }
+ return *user, err
+}
+
+func (u *UserProvider) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
+ var err error
+
+ println("req:%#v", req)
+ rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
+ rsp.Sex = Gender(MAN).String()
+ return err
+}
+
+func (u *UserProvider) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider) GetUsers(req []interface{}) ([]User, error) {
+ var err error
+
+ println("req:%s", req)
+ t := req[0].([]interface{})
+ user, err := u.getUser(t[0].(string))
+ if err != nil {
+ return nil, err
+ }
+ println("user:%v", user)
+ user1, err := u.getUser(t[1].(string))
+ if err != nil {
+ return nil, err
+ }
+ println("user1:%v", user1)
+
+ return []User{*user, *user1}, err
+}
+
+func (s *UserProvider) MethodMapper() map[string]string {
+ return map[string]string{
+ "GetUser2": "getUser",
+ }
+}
+
+func (u *UserProvider) Reference() string {
+ return "UserProvider"
+}
diff --git a/golang/tracing/jsonrpc/go-server/app/user_provider1.go b/golang/tracing/jsonrpc/go-server/app/user_provider1.go
new file mode 100755
index 0000000..1557c6b
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/user_provider1.go
@@ -0,0 +1,83 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+ perrors "github.com/pkg/errors"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider1))
+}
+
+type UserProvider1 struct {
+}
+
+func (u *UserProvider1) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider1) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ println("req:%#v", req)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider1) GetUser0(id string, name string) (User, error) {
+ var err error
+
+ println("id:%s, name:%s", id, name)
+ user, err := u.getUser(id)
+ if err != nil {
+ return User{}, err
+ }
+ if user.Name != name {
+ return User{}, perrors.New("name is not " + user.Name)
+ }
+ return *user, err
+}
+
+func (u *UserProvider1) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
+ var err error
+
+ println("req:%#v", req)
+ rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
+ rsp.Sex = Gender(MAN).String()
+ return err
+}
+
+func (u *UserProvider1) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider1) GetUsers(req []interface{}) ([]User, error) {
+ return []User{}, nil
+}
+
+func (s *UserProvider1) MethodMapper() map[string]string {
+ return map[string]string{
+ "GetUser2": "getUser",
+ }
+}
+
+func (u *UserProvider1) Reference() string {
+ return "UserProvider1"
+}
diff --git a/golang/tracing/jsonrpc/go-server/app/user_provider2.go b/golang/tracing/jsonrpc/go-server/app/user_provider2.go
new file mode 100755
index 0000000..7d2fb80
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/user_provider2.go
@@ -0,0 +1,93 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "strconv"
+)
+
+import (
+ "github.com/apache/dubbo-go/config"
+ perrors "github.com/pkg/errors"
+)
+
+func init() {
+ config.SetProviderService(new(UserProvider2))
+}
+
+type UserProvider2 struct {
+}
+
+func (u *UserProvider2) getUser(userId string) (*User, error) {
+ if user, ok := userMap[userId]; ok {
+ return &user, nil
+ }
+
+ return nil, fmt.Errorf("invalid user id:%s", userId)
+}
+
+func (u *UserProvider2) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+ var (
+ err error
+ user *User
+ )
+
+ println("req:%#v", req)
+ user, err = u.getUser(req[0].(string))
+ if err == nil {
+ *rsp = *user
+ println("rsp:%#v", rsp)
+ }
+ return err
+}
+
+func (u *UserProvider2) GetUser0(id string, name string) (User, error) {
+ var err error
+
+ println("id:%s, name:%s", id, name)
+ user, err := u.getUser(id)
+ if err != nil {
+ return User{}, err
+ }
+ if user.Name != name {
+ return User{}, perrors.New("name is not " + user.Name)
+ }
+ return *user, err
+}
+
+func (u *UserProvider2) GetUser2(ctx context.Context, req []interface{}, rsp *User) error {
+ var err error
+
+ println("req:%#v", req)
+ rsp.Id = strconv.FormatFloat(req[0].(float64), 'f', 0, 64)
+ rsp.Sex = Gender(MAN).String()
+ return err
+}
+
+func (u *UserProvider2) GetUser3() error {
+ return nil
+}
+
+func (u *UserProvider2) GetUsers(req []interface{}) ([]User, error) {
+ var err error
+
+ println("req:%s", req)
+ t := req[0].([]interface{})
+ user, err := u.getUser(t[0].(string))
+ if err != nil {
+ return nil, err
+ }
+ println("user:%v", user)
+
+ return []User{*user}, err
+}
+
+func (s *UserProvider2) MethodMapper() map[string]string {
+ return map[string]string{
+ "GetUser2": "getUser",
+ }
+}
+
+func (u *UserProvider2) Reference() string {
+ return "UserProvider2"
+}
diff --git a/golang/tracing/jsonrpc/go-server/app/version.go b/golang/tracing/jsonrpc/go-server/app/version.go
new file mode 100755
index 0000000..c613858
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/app/version.go
@@ -0,0 +1,22 @@
+/*
+ * 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.6.0"
+)
diff --git a/golang/tracing/jsonrpc/go-server/assembly/bin/load.sh b/golang/tracing/jsonrpc/go-server/assembly/bin/load.sh
new file mode 100755
index 0000000..90077c2
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/bin/load.sh
@@ -0,0 +1,151 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/common/app.properties b/golang/tracing/jsonrpc/go-server/assembly/common/app.properties
new file mode 100755
index 0000000..1f0827e
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/common/app.properties
@@ -0,0 +1,23 @@
+#
+# 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/golang/tracing/jsonrpc/go-server/assembly/common/build.sh b/golang/tracing/jsonrpc/go-server/assembly/common/build.sh
new file mode 100755
index 0000000..d90d026
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/common/build.sh
@@ -0,0 +1,80 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/linux/dev.sh b/golang/tracing/jsonrpc/go-server/assembly/linux/dev.sh
new file mode 100755
index 0000000..d830ac9
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/linux/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/linux/release.sh b/golang/tracing/jsonrpc/go-server/assembly/linux/release.sh
new file mode 100755
index 0000000..9930380
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/linux/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/linux/test.sh b/golang/tracing/jsonrpc/go-server/assembly/linux/test.sh
new file mode 100755
index 0000000..87144bb
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/linux/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/mac/dev.sh b/golang/tracing/jsonrpc/go-server/assembly/mac/dev.sh
new file mode 100755
index 0000000..3a7659b
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/mac/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/mac/release.sh b/golang/tracing/jsonrpc/go-server/assembly/mac/release.sh
new file mode 100755
index 0000000..1c4bce4
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/mac/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/mac/test.sh b/golang/tracing/jsonrpc/go-server/assembly/mac/test.sh
new file mode 100755
index 0000000..69206e3
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/mac/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/windows/dev.sh b/golang/tracing/jsonrpc/go-server/assembly/windows/dev.sh
new file mode 100755
index 0000000..011fb41
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/windows/dev.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/windows/release.sh b/golang/tracing/jsonrpc/go-server/assembly/windows/release.sh
new file mode 100755
index 0000000..679a26a
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/windows/release.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/assembly/windows/test.sh b/golang/tracing/jsonrpc/go-server/assembly/windows/test.sh
new file mode 100755
index 0000000..4a36de0
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/assembly/windows/test.sh
@@ -0,0 +1,36 @@
+#!/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/golang/tracing/jsonrpc/go-server/profiles/dev/log.yml b/golang/tracing/jsonrpc/go-server/profiles/dev/log.yml
new file mode 100755
index 0000000..59fa427
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/dev/log.yml
@@ -0,0 +1,28 @@
+
+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:
diff --git a/golang/tracing/jsonrpc/go-server/profiles/dev/server.yml b/golang/tracing/jsonrpc/go-server/profiles/dev/server.yml
new file mode 100755
index 0000000..1f1668d
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/dev/server.yml
@@ -0,0 +1,76 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "dev"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ #- name: "dubbo"
+ # ip : "127.0.0.1"
+ # port : 20000
+ "jsonrpc":
+ name: "jsonrpc"
+ ip: "127.0.0.1"
+ port: 20001
+
+filter: "tracing"
diff --git a/golang/tracing/jsonrpc/go-server/profiles/release/log.yml b/golang/tracing/jsonrpc/go-server/profiles/release/log.yml
new file mode 100755
index 0000000..e0514be
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/release/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/jsonrpc/go-server/profiles/release/server.yml b/golang/tracing/jsonrpc/go-server/profiles/release/server.yml
new file mode 100755
index 0000000..f7e435b
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/release/server.yml
@@ -0,0 +1,75 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "release"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ #- name: "dubbo"
+ # ip : "127.0.0.1"
+ # port : 20000
+ "jsonrpc":
+ name: "jsonrpc"
+ ip: "127.0.0.1"
+ port: 20001
+
diff --git a/golang/tracing/jsonrpc/go-server/profiles/test/log.yml b/golang/tracing/jsonrpc/go-server/profiles/test/log.yml
new file mode 100755
index 0000000..baee0b7
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/test/log.yml
@@ -0,0 +1,28 @@
+
+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/golang/tracing/jsonrpc/go-server/profiles/test/server.yml b/golang/tracing/jsonrpc/go-server/profiles/test/server.yml
new file mode 100755
index 0000000..63bcbd2
--- /dev/null
+++ b/golang/tracing/jsonrpc/go-server/profiles/test/server.yml
@@ -0,0 +1,75 @@
+# dubbo server yaml configure file
+
+# application config
+application:
+ organization : "ikurento.com"
+ name : "BDTService"
+ module : "dubbogo user-info server"
+ version : "0.0.1"
+ owner : "ZX"
+ environment : "test"
+
+registries :
+ "hangzhouzk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2181"
+ username: ""
+ password: ""
+ "shanghaizk":
+ protocol: "zookeeper"
+ timeout : "3s"
+ address: "127.0.0.1:2182"
+ username: ""
+ password: ""
+
+
+services:
+ "UserProvider":
+ # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册
+ registry: "hangzhouzk"
+ protocol : "jsonrpc"
+ # 相当于dubbo.xml中的interface
+ interface : "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider1":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+ "UserProvider2":
+ registry: "hangzhouzk"
+ protocol: "jsonrpc"
+ interface: "com.ikurento.user.UserProvider"
+ loadbalance: "random"
+ version: "2.0"
+ group: "as"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "GetUser"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ #- name: "dubbo"
+ # ip : "127.0.0.1"
+ # port : 20000
+ "jsonrpc":
+ name: "jsonrpc"
+ ip: "127.0.0.1"
+ port: 20001
+
diff --git a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java
index f448a18..ea2be4e 100644
--- a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java
+++ b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java
@@ -25,7 +25,13 @@
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-consumer.xml");
context.start();
DemoService demoService = context.getBean("demoService", DemoService.class);
+// try {
+// Thread.sleep(100000);
+// } catch (Exception e) {
+// }
String hello = demoService.sayHello("world");
+
+
System.out.println("result: " + hello);
}
}
diff --git a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml
index 892392a..d8bdd18 100644
--- a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml
+++ b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml
@@ -23,8 +23,9 @@
<dubbo:application name="demo-consumer"/>
+<!-- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>-->
<dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>
- <dubbo:reference id="demoService" check="false" interface="org.apache.dubbo.demo.DemoService"/>
+ <dubbo:reference id="demoService" check="false" interface="org.apache.dubbo.demo.DemoService" provided-by="demo-provider"/>
</beans>
diff --git a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml
index fce0c7f..078af9d 100644
--- a/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml
+++ b/java/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml
@@ -21,14 +21,17 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
- <dubbo:application name="demo-provider"/>
+ <dubbo:application name="demo-provider" metadata-type="remote"/>
- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>
+<!-- <dubbo:registry address="zookeeper://127.0.0.1:2181?registry-type=service"/>-->
+ <dubbo:registry address="nacos://127.0.0.1:8848?registry-type=service"/>
- <dubbo:protocol name="dubbo"/>
+ <dubbo:protocol name="dubbo" port="20881"/>
+
+ <dubbo:metadata-report address="nacos://127.0.0.1:8848" />
<bean id="demoService" class="org.apache.dubbo.demo.provider.DemoServiceImpl"/>
- <dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoService"/>
+ <dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoService" weight="12"/>
</beans>