This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch INLONG-25
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/INLONG-25 by this push:
new 34ea63c [INLONG-1533]Provide more example for Go SDK (#1534)
34ea63c is described below
commit 34ea63c515163e8945fc01bf4f79d10be8679139
Author: Zijie Lu <[email protected]>
AuthorDate: Thu Sep 9 09:08:23 2021 +0800
[INLONG-1533]Provide more example for Go SDK (#1534)
Signed-off-by: Zijie Lu <[email protected]>
---
tubemq-client-twins/tubemq-client-go/example/consumer.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tubemq-client-twins/tubemq-client-go/example/consumer.go
b/tubemq-client-twins/tubemq-client-go/example/consumer.go
index eb3d988..ca9ccad 100644
--- a/tubemq-client-twins/tubemq-client-go/example/consumer.go
+++ b/tubemq-client-twins/tubemq-client-go/example/consumer.go
@@ -26,7 +26,17 @@ import (
)
func main() {
+ // Example for using config directly
+ // cfg := config.NewDefaultConfig()
+ // For topic filter
+ // cfg.Consumer.TopicFilters = map[string][]string{"topic1":
{"filter1", "filter2"}, "topic2": {"filter3", "filter4"}}
+ // For part offset
+ // cfg.Consumer.PartitionOffset = map[string]int64{"181895251:test_1":
0, "181895251:test_2": 10}
+
+ // Example for parseAddress
cfg, err :=
config.ParseAddress("9.23.27.160:8099?topics=test_1&group=test_group")
+ // For topic filter
+ // cfg, err :=
config.ParseAddress("9.23.27.160:8099?topics=Topic1@12312323,1212;Topic2@121212,2321323&group=test_group")
if err != nil {
log.Errorf("Failed to parse address", err.Error())
panic(err)