You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/04/05 10:35:59 UTC
[GitHub] [dubbo-go-samples] PhilYue opened a new pull request #82: Ftr: add the module of shopping-order
PhilYue opened a new pull request #82:
URL: https://github.com/apache/dubbo-go-samples/pull/82
1. add the module of shopping-order, contains examples of distributed solutions by Seata
2. add the config of .run
3. update dubbo-go version, v1.5.6-rc1 to v1.5.6-rc2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-samples] AlexStocks commented on a change in pull request #82: Ftr: add the module of shopping-order
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #82:
URL: https://github.com/apache/dubbo-go-samples/pull/82#discussion_r607120943
##########
File path: shopping-order/go-client/cmd/client.go
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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"
+ "github.com/apache/dubbo-go-samples/shopping-order/go-client/pkg"
Review comment:
move it to the 3rd import block.
##########
File path: shopping-order/go-server-order/cmd/server.go
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 (
+ "database/sql"
+ "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/metadata/service/inmemory"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ "github.com/transaction-wg/seata-golang/pkg/client"
+ "github.com/transaction-wg/seata-golang/pkg/client/at/exec"
+ seataConfig "github.com/transaction-wg/seata-golang/pkg/client/config"
+ //_ "github.com/apache/dubbo-go/registry/nacos"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+import (
Review comment:
add blank line above
##########
File path: shopping-order/go-client/conf/seata.yml
##########
@@ -0,0 +1,23 @@
+application_id: "aggregation-svc"
+transaction_service_group: "127.0.0.1:8091"
+enable-client-batch-send-request: true
+seata_version: "1.2.0"
+getty:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "10s"
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "180s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 4096
Review comment:
change it to 8388608
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
+ "github.com/apache/dubbo-go/common/extension"
+ "github.com/apache/dubbo-go/filter"
+ "github.com/apache/dubbo-go/protocol"
+)
+import (
+// inner
+)
+
+const (
+ SEATA = "seata"
+ SEATA_XID = "seata_xid"
+)
+
+func init() {
+ extension.SetFilter(SEATA, getSeataFilter)
+}
+
+// SeataFilter ...
+type SeataFilter struct {
+}
+
+// Invoke ...
Review comment:
add comment
##########
File path: shopping-order/go-server-order/conf/seata.yml
##########
@@ -0,0 +1,28 @@
+application_id: "order-svc"
+transaction_service_group: "127.0.0.1:8091"
+seata_version: "1.2.0"
+getty:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "10s"
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "180s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 4096
Review comment:
change it to 8688608
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
+ "github.com/apache/dubbo-go/common/extension"
+ "github.com/apache/dubbo-go/filter"
+ "github.com/apache/dubbo-go/protocol"
+)
+import (
+// inner
+)
+
+const (
+ SEATA = "seata"
+ SEATA_XID = "seata_xid"
+)
+
+func init() {
+ extension.SetFilter(SEATA, getSeataFilter)
+}
+
+// SeataFilter ...
Review comment:
// nolint
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
+ "github.com/apache/dubbo-go/common/extension"
+ "github.com/apache/dubbo-go/filter"
+ "github.com/apache/dubbo-go/protocol"
+)
+import (
+// inner
+)
+
+const (
+ SEATA = "seata"
+ SEATA_XID = "seata_xid"
+)
+
+func init() {
+ extension.SetFilter(SEATA, getSeataFilter)
+}
+
+// SeataFilter ...
+type SeataFilter struct {
+}
+
+// Invoke ...
+func (sf *SeataFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
+ xid := invocation.AttachmentsByKey(SEATA_XID, "")
+ if xid != "" {
+ return invoker.Invoke(context.WithValue(ctx, SEATA_XID, xid), invocation)
+ }
+ return invoker.Invoke(ctx, invocation)
+}
+
+// OnResponse ...
Review comment:
add comment
##########
File path: shopping-order/go-server-order/conf/server.yml
##########
@@ -0,0 +1,51 @@
+application:
+ organization: "dubbo.io"
+ name: "BDTService"
+ module: "dubbogo shopping-order server"
+ version: "0.0.1"
+ environment: "dev"
+
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+
+filter: "seata"
+
+services:
+ "OrderSvc":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.OrderSvc"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "CreateSo"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20000
+
+protocol_conf:
+ dubbo:
+ 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
Review comment:
change it to 8388608
##########
File path: shopping-order/go-server-product/cmd/server.go
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 (
+ "database/sql"
+ "fmt"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
Review comment:
pls add blank line btw import block.
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
+ "github.com/apache/dubbo-go/common/extension"
+ "github.com/apache/dubbo-go/filter"
+ "github.com/apache/dubbo-go/protocol"
+)
+import (
+// inner
+)
+
+const (
+ SEATA = "seata"
+ SEATA_XID = "seata_xid"
+)
+
+func init() {
+ extension.SetFilter(SEATA, getSeataFilter)
+}
+
+// SeataFilter ...
+type SeataFilter struct {
+}
+
+// Invoke ...
+func (sf *SeataFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
+ xid := invocation.AttachmentsByKey(SEATA_XID, "")
+ if xid != "" {
+ return invoker.Invoke(context.WithValue(ctx, SEATA_XID, xid), invocation)
+ }
+ return invoker.Invoke(ctx, invocation)
+}
+
+// OnResponse ...
+func (sf *SeataFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
+ return result
+}
+
+// GetSeataFilter ...
Review comment:
delete this comment
##########
File path: shopping-order/go-client/conf/client.yml
##########
@@ -0,0 +1,63 @@
+check: true
+request_timeout: "3s"
+connect_timeout: "3s"
+
+application:
+ organization: "dubbo.io"
+ name: "BDTService"
+ module: "dubbogo user-info client"
+ version: "0.0.1"
+ environment: "dev"
+
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+# "nacos":
+# protocol: "nacos"
+# timeout: "3s"
+# address: "nacos:8848"
+
+references:
+ "OrderSvc":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.OrderSvc"
+ cluster: "failover"
+ url: "dubbo://127.0.0.1:20000"
+ methods:
+ - name: "CreateSo"
+ retries: 3
+ "ProductSvc":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.ProductSvc"
+ cluster: "failover"
+ url: "dubbo://127.0.0.1:20001"
+ methods:
+ - name: "AllocateInventory"
+ 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: 10240
Review comment:
change it to 8388608 which is 8MiB
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
+ "github.com/apache/dubbo-go/common/extension"
+ "github.com/apache/dubbo-go/filter"
+ "github.com/apache/dubbo-go/protocol"
+)
+import (
Review comment:
delete this blank import block.
##########
File path: shopping-order/go-server-product/cmd/server.go
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 (
+ "database/sql"
+ "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/metadata/service/inmemory"
+ _ "github.com/apache/dubbo-go/protocol/dubbo"
+ _ "github.com/apache/dubbo-go/registry/protocol"
+ "github.com/transaction-wg/seata-golang/pkg/client"
+ "github.com/transaction-wg/seata-golang/pkg/client/at/exec"
+ seataConfig "github.com/transaction-wg/seata-golang/pkg/client/config"
+ //_ "github.com/apache/dubbo-go/registry/nacos"
+ _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+import (
Review comment:
add blank line above
##########
File path: shopping-order/go-server-common/filter/seata_filter.go
##########
@@ -0,0 +1,45 @@
+package filter
+
+import (
+ "context"
+)
+import (
Review comment:
add blank above.
##########
File path: shopping-order/go-server-product/conf/seata.yml
##########
@@ -0,0 +1,30 @@
+application_id: "product-svc"
+transaction_service_group: "127.0.0.1:8091"
+
+seata_version: "1.2.0"
+
+getty:
+ reconnect_interval: 0
+ connection_number: 1
+ heartbeat_period: "10s"
+ getty_session_param:
+ compress_encoding: false
+ tcp_no_delay: true
+ tcp_keep_alive: true
+ keep_alive_period: "180s"
+ tcp_r_buf_size: 262144
+ tcp_w_buf_size: 65536
+ tcp_read_timeout: "1s"
+ tcp_write_timeout: "5s"
+ wait_timeout: "1s"
+ max_msg_len: 4096
Review comment:
change it to 8388608
##########
File path: shopping-order/go-server-product/conf/server.yml
##########
@@ -0,0 +1,55 @@
+application:
+ organization: "dubbo.io"
+ name: "BDTService"
+ module: "dubbogo shopping-product server"
+ version: "0.0.1"
+ environment: "dev"
+
+registries:
+ "demoZk":
+ protocol: "zookeeper"
+ timeout: "3s"
+ address: "127.0.0.1:2181"
+# "nacos":
+# protocol: "nacos"
+# timeout: "3s"
+# address: "nacos:8848"
+
+filter: "seata"
+
+services:
+ "ProductSvc":
+ registry: "demoZk"
+ protocol: "dubbo"
+ interface: "org.apache.dubbo.ProductSvc"
+ loadbalance: "random"
+ warmup: "100"
+ cluster: "failover"
+ methods:
+ - name: "AllocateInventory"
+ retries: 1
+ loadbalance: "random"
+
+protocols:
+ "dubbo":
+ name: "dubbo"
+ port: 20001
+
+protocol_conf:
+ dubbo:
+ 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
Review comment:
change it to 8388608
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-samples] AlexStocks commented on a change in pull request #82: Ftr: add the module of shopping-order
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #82:
URL: https://github.com/apache/dubbo-go-samples/pull/82#discussion_r611206057
##########
File path: shopping-order/go.mod
##########
@@ -0,0 +1,26 @@
+module github.com/apache/dubbo-go-samples/shopping-order
+
+require (
+ cloud.google.com/go v0.50.0 // indirect
+ github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect
+ github.com/apache/dubbo-go v1.5.6-rc2
+ github.com/apache/dubbo-go-hessian2 v1.9.1
+ github.com/bwmarrin/snowflake v0.3.0
+ github.com/docker/go-connections v0.4.0 // indirect
+ github.com/gophercloud/gophercloud v0.3.0 // indirect
+ github.com/hashicorp/golang-lru v0.5.3 // indirect
+ github.com/imdario/mergo v0.3.9 // indirect
+ github.com/linode/linodego v0.10.0 // indirect
+ github.com/miekg/dns v1.1.27 // indirect
+ github.com/mitchellh/hashstructure v1.0.0 // indirect
+ github.com/opentrx/mysql v1.0.0-pre
+ github.com/transaction-wg/seata-golang v0.2.1-alpha
+ github.com/uber/jaeger-lib v2.2.0+incompatible // indirect
+ google.golang.org/grpc/examples v0.0.0-20210322221411-d26af8e39165 // indirect
+)
+
+replace github.com/envoyproxy/go-control-plane => github.com/envoyproxy/go-control-plane v0.8.0
Review comment:
merge the two `replace` lines.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-samples] beiwei30 merged pull request #82: Ftr: add the module of shopping-order
Posted by GitBox <gi...@apache.org>.
beiwei30 merged pull request #82:
URL: https://github.com/apache/dubbo-go-samples/pull/82
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-samples] zhaoyunxing92 commented on a change in pull request #82: Ftr: add the module of shopping-order
Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on a change in pull request #82:
URL: https://github.com/apache/dubbo-go-samples/pull/82#discussion_r611749486
##########
File path: shopping-order/go-server-order/cmd/order_svc.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"
+)
+
+import (
+ "github.com/apache/dubbo-go/common/constant"
Review comment:
dubbo-go的包放一个import里面会好点
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org