You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/12/25 15:48:19 UTC

[GitHub] [incubator-eventmesh] walleliu1016 opened a new pull request, #2688: change go server project structure

walleliu1016 opened a new pull request, #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688

   <!--
   ### Contribution Checklist
   
     - Name the pull request in the form "[ISSUE #XXXX] Title of the pull request", 
       where *XXXX* should be replaced by the actual issue number.
       Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
   
     - Fill out the template below to describe the changes contributed by the pull request. 
       That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue. 
       Please do not mix up code from multiple issues.
     
     - Each commit in the pull request should have a meaningful commit message.
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, 
       leaving only the filled out template below.
   
   (The sections below can be removed for hotfixes of typos)
   -->
   
   <!--
   (If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Cloese #<XXX>`.)
   -->
   
   Fixes  #2687 
   
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] walleliu1016 commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
walleliu1016 commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057090011


##########
eventmesh-server-go/config/config_test.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 config
+
+import (
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin"
+	testifyassert "github.com/stretchr/testify/assert"
+	"gopkg.in/yaml.v3"
+	"os"
+	"testing"
+	"time"
+)
+
+func TestConfig_Load(t *testing.T) {
+	assert := testifyassert.New(t)
+
+	config := &Config{}
+	config.Server.GRPCOption = &GRPCOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		SendPoolSize:          10,
+		SubscribePoolSize:     10,
+		RetryPoolSize:         10,
+		PushMessagePoolSize:   10,
+		ReplyPoolSize:         10,
+		MsgReqNumPerSecond:    5,
+		RegistryName:          "test",
+		Cluster:               "test",
+		Env:                   "env",
+		IDC:                   "idc1",
+		SessionExpiredInMills: 5 * time.Second,
+		SendMessageTimeout:    5 * time.Second,
+	}
+	config.Server.HTTPOption = &HTTPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+	}
+	config.Server.TCPOption = &TCPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		Multicore: false,
+	}
+	config.ActivePlugins = map[string]string{
+		"registry":  "nacos",
+		"connector": "rocketmq",
+		"log":       "default",
+	}
+	config.Plugins = plugin.Config{}
+
+	schedulerConfigYAML := &Config{}

Review Comment:
   i will rename it



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057154439


##########
eventmesh-server-go/runtime/core/protocol/grpc/heartbeat/heartbeat_service.go:
##########
@@ -51,7 +52,7 @@ func (h *HeartbeatService) Heartbeat(ctx context.Context, hb *pb.Heartbeat) (*pb
 		err     error
 	)
 	h.pool.Submit(func() {
-		resp, err = ProcessHeartbeat(h.gctx, hb)
+		resp, err = NewProcessor().Heartbeat(h.consumerMgr, hb)

Review Comment:
   suggest use global variable , avoid new object action for each call Submit method.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] walleliu1016 commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
walleliu1016 commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057089960


##########
eventmesh-server-go/runtime/core/protocol/grpc/consumer/consumer_group_option_test.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 consumer
+
+import "testing"
+
+func Test_NewConsumerGroupTopicOption(t *testing.T) {
+

Review Comment:
   Modify the project structure first, the original structure is not easy to write mocks code, in order to prevent too much code submitted at one time, so submit this pr first.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057016070


##########
eventmesh-server-go/runtime/core/protocol/grpc/consumer/consumer_group_option_test.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 consumer
+
+import "testing"
+
+func Test_NewConsumerGroupTopicOption(t *testing.T) {
+

Review Comment:
   There is no testcode



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057015850


##########
eventmesh-server-go/config/config_test.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 config
+
+import (
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin"
+	testifyassert "github.com/stretchr/testify/assert"
+	"gopkg.in/yaml.v3"
+	"os"
+	"testing"
+	"time"
+)
+
+func TestConfig_Load(t *testing.T) {
+	assert := testifyassert.New(t)
+
+	config := &Config{}
+	config.Server.GRPCOption = &GRPCOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		SendPoolSize:          10,
+		SubscribePoolSize:     10,
+		RetryPoolSize:         10,
+		PushMessagePoolSize:   10,
+		ReplyPoolSize:         10,
+		MsgReqNumPerSecond:    5,
+		RegistryName:          "test",
+		Cluster:               "test",
+		Env:                   "env",
+		IDC:                   "idc1",
+		SessionExpiredInMills: 5 * time.Second,
+		SendMessageTimeout:    5 * time.Second,
+	}
+	config.Server.HTTPOption = &HTTPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+	}
+	config.Server.TCPOption = &TCPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		Multicore: false,
+	}
+	config.ActivePlugins = map[string]string{
+		"registry":  "nacos",
+		"connector": "rocketmq",
+		"log":       "default",
+	}
+	config.Plugins = plugin.Config{}
+
+	schedulerConfigYAML := &Config{}

Review Comment:
   suggest to rename varaible,schedulerConfigYAML is mislead.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] codecov[bot] commented on pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#issuecomment-1364705012

   # [Codecov](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2688](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (292e065) into [master](https://codecov.io/gh/apache/incubator-eventmesh/commit/8412783b84d1a3024a4af1628603d92c99606606?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8412783) will **decrease** coverage by `0.00%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2688      +/-   ##
   ============================================
   - Coverage     11.87%   11.87%   -0.01%     
     Complexity      900      900              
   ============================================
     Files           476      476              
     Lines         27110    27099      -11     
     Branches       2770     2768       -2     
   ============================================
   - Hits           3220     3218       -2     
   + Misses        23602    23593       -9     
     Partials        288      288              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../admin/handler/QueryRecommendEventMeshHandler.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2FkbWluL2hhbmRsZXIvUXVlcnlSZWNvbW1lbmRFdmVudE1lc2hIYW5kbGVyLmphdmE=) | `33.33% <0.00%> (-3.71%)` | :arrow_down: |
   | [.../trace/pinpoint/exporter/PinpointSpanExporter.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXRyYWNlLXBsdWdpbi9ldmVudG1lc2gtdHJhY2UtcGlucG9pbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC90cmFjZS9waW5wb2ludC9leHBvcnRlci9QaW5wb2ludFNwYW5FeHBvcnRlci5qYXZh) | `68.24% <0.00%> (-0.68%)` | :arrow_down: |
   | [...che/eventmesh/runtime/boot/AbstractHTTPServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvQWJzdHJhY3RIVFRQU2VydmVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...che/eventmesh/runtime/boot/EventMeshTCPServer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2Jvb3QvRXZlbnRNZXNoVENQU2VydmVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...sh/client/http/producer/EventMeshHttpProducer.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXNkay1qYXZhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvY2xpZW50L2h0dHAvcHJvZHVjZXIvRXZlbnRNZXNoSHR0cFByb2R1Y2VyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../protocol/tcp/client/group/ClientGroupWrapper.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvdGNwL2NsaWVudC9ncm91cC9DbGllbnRHcm91cFdyYXBwZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...pl/consumer/ConsumeMessageConcurrentlyService.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1yb2NrZXRtcS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY2xpZW50L2ltcGwvY29uc3VtZXIvQ29uc3VtZU1lc3NhZ2VDb25jdXJyZW50bHlTZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...otocol/meshmessage/MeshMessageProtocolAdaptor.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2688/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXByb3RvY29sLXBsdWdpbi9ldmVudG1lc2gtcHJvdG9jb2wtbWVzaG1lc3NhZ2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9wcm90b2NvbC9tZXNobWVzc2FnZS9NZXNoTWVzc2FnZVByb3RvY29sQWRhcHRvci5qYXZh) | `3.84% <0.00%> (+0.07%)` | :arrow_up: |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx merged pull request #2688: [ISSUE #2687]change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx merged PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057042537


##########
eventmesh-server-go/config/config_test.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 config
+
+import (
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin"
+	testifyassert "github.com/stretchr/testify/assert"
+	"gopkg.in/yaml.v3"
+	"os"
+	"testing"
+	"time"
+)
+
+func TestConfig_Load(t *testing.T) {
+	assert := testifyassert.New(t)
+
+	config := &Config{}
+	config.Server.GRPCOption = &GRPCOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		SendPoolSize:          10,
+		SubscribePoolSize:     10,
+		RetryPoolSize:         10,
+		PushMessagePoolSize:   10,
+		ReplyPoolSize:         10,
+		MsgReqNumPerSecond:    5,
+		RegistryName:          "test",
+		Cluster:               "test",
+		Env:                   "env",
+		IDC:                   "idc1",
+		SessionExpiredInMills: 5 * time.Second,
+		SendMessageTimeout:    5 * time.Second,
+	}
+	config.Server.HTTPOption = &HTTPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+	}
+	config.Server.TCPOption = &TCPOption{
+		Port: "10010",
+		TLSOption: &TLSOption{
+			EnableInsecure: false,
+			CA:             "",
+			Certfile:       "",
+			Keyfile:        "",
+		},
+		PProfOption: &PProfOption{
+			Port: "10011",
+		},
+		Multicore: false,
+	}
+	config.ActivePlugins = map[string]string{
+		"registry":  "nacos",
+		"connector": "rocketmq",
+		"log":       "default",
+	}
+	config.Plugins = plugin.Config{}
+
+	schedulerConfigYAML := &Config{}

Review Comment:
   > suggest to rename varaible,schedulerConfigYAML is mislead.
   @walleliu1016 
   



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057167971


##########
eventmesh-server-go/runtime/core/protocol/grpc/consumer/consumer_service.go:
##########
@@ -116,7 +120,7 @@ func (c *ConsumerService) Unsubscribe(ctx context.Context, sub *pb.Subscription)
 		err     error
 	)
 	c.subscribePool.Submit(func() {
-		resp, err = ProcessUnSubscribe(c.gctx, sub)
+		resp, err = NewProcessor().UnSubscribe(c.consumerManager, sub)

Review Comment:
   suggest use global variable.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057016335


##########
eventmesh-server-go/runtime/core/protocol/grpc/consumer/consumer_service_test.go:
##########
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT 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 consumer
+
+import (
+	"context"
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/pkg/util"
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/runtime/core/protocol/grpc/mocks"
+	"github.com/apache/incubator-eventmesh/eventmesh-server-go/runtime/proto/pb"
+	"github.com/golang/mock/gomock"
+	"testing"
+)
+
+func Test_Subscribe(t *testing.T) {
+	mockctl := gomock.NewController(t)
+	mockConsumer := mocks.NewMockConsumerServiceServer(mockctl)
+	mockConsumer.EXPECT().Subscribe(context.TODO(), &pb.Subscription{
+		Header: &pb.RequestHeader{
+			Env:             "grpc-env",
+			Region:          "sh",
+			Idc:             "idc-sh",
+			Ip:              util.GetIP(),
+			Pid:             util.PID(),
+			Sys:             "grpc-sys",
+			Username:        "grpc-username",
+			Password:        "grpc-passwd",
+			Language:        "Go",
+			ProtocolType:    "cloudevents",
+			ProtocolVersion: "1.0",
+			ProtocolDesc:    "cloudevents",
+		},
+		ConsumerGroup: "grpc-stream-consumergroup",
+		SubscriptionItems: []*pb.Subscription_SubscriptionItem{
+			{
+				Topic: "test_topic",
+				Mode:  pb.Subscription_SubscriptionItem_CLUSTERING,
+				Type:  pb.Subscription_SubscriptionItem_SYNC,
+			},
+		},
+		Url: "http://127.0.0.1:18080/onmessage",
+	}).Return()
+}
+
+func Test_unsubscribe(t *testing.T) {
+	//cli := grpc.newTestClient(t)

Review Comment:
   There is no test code.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2688: change go server project structure

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2688:
URL: https://github.com/apache/incubator-eventmesh/pull/2688#discussion_r1057153761


##########
eventmesh-server-go/runtime/core/protocol/grpc/producer/producer_service.go:
##########
@@ -55,7 +55,7 @@ func (p *ProducerService) Publish(ctx context.Context, msg *pb.SimpleMessage) (*
 		err     error
 	)
 	p.sendPool.Submit(func() {
-		resp, err = ProcessAsyncMessage(ctx, p.gctx, msg)
+		resp, err = NewProcessor().AsyncMessage(ctx, p.producerMgr, msg)

Review Comment:
   suggest use global variable ,avoid new object action when each mehod call。



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org