forked from apache/dubbo-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from apache/develop
Sync latest Develop
- Loading branch information
Showing
19 changed files
with
969 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
# | ||
|
||
FROM golang | ||
|
||
WORKDIR /go/src/github.com/apache/dubbo-go/test/integrate/dubbo/go-client | ||
|
||
ENV CONF_CONSUMER_FILE_PATH "client.yml" | ||
ENV APP_LOG_CONF_FILE "log.yml" | ||
|
||
ARG PR_ORIGIN_REPO | ||
ARG PR_ORIGIN_COMMITID | ||
|
||
ADD . /go/src/github.com/apache/dubbo-go/test/integrate/dubbo/go-client | ||
|
||
# update dubbo-go to current commit id | ||
RUN echo "github.com/apache/dubbo-go will be replace to github.com/${PR_ORIGIN_REPO}@${PR_ORIGIN_COMMITID}" | ||
RUN go mod edit -replace=github.com/apache/dubbo-go=github.com/${PR_ORIGIN_REPO}@${PR_ORIGIN_COMMITID} | ||
|
||
RUN go install github.com/apache/dubbo-go/test/integrate/dubbo/go-client | ||
|
||
CMD go-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT 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/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() | ||
time.Sleep(3e9) | ||
|
||
println("\n\n\nstart to test dubbo") | ||
|
||
go func() { | ||
select { | ||
case <-time.After(time.Minute): | ||
panic("provider not start after client already running 1min") | ||
} | ||
}() | ||
user := &User{} | ||
err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user) | ||
if err != nil { | ||
panic(err) | ||
} | ||
println("response result: %v\n", user) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: "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: 1024000 | ||
session_name: "client" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/apache/dubbo-go/test/integrate/dubbo/go-client | ||
|
||
go 1.13 |
Oops, something went wrong.