This is an automated email from the ASF dual-hosted git repository. yukon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
commit 9542c7ddc75beae61aceae0a30f6b581e863f402 Author: guyinyou <[email protected]> AuthorDate: Mon Oct 10 15:03:40 2022 +0800 format code --- golang/example/consumer/simple_consumer/main.go | 24 ++++++++++++------------ golang/example/producer/async/main.go | 12 ++++++------ golang/example/producer/delay/main.go | 10 +++++----- golang/example/producer/fifo/main.go | 10 +++++----- golang/example/producer/normal/main.go | 10 +++++----- golang/example/producer/transaction/main.go | 16 ++++++++-------- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/golang/example/consumer/simple_consumer/main.go b/golang/example/consumer/simple_consumer/main.go index b6ff29c..7be67c1 100644 --- a/golang/example/consumer/simple_consumer/main.go +++ b/golang/example/consumer/simple_consumer/main.go @@ -24,16 +24,16 @@ import ( "os" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) const ( - Topic = "xxxxxx" - GroupName = "xxxxxx" - Endpoint = "xxxxxx" - AccessKey = "xxxxxx" - SecretKey = "xxxxxx" + Topic = "xxxxxx" + ConsumerGroup = "xxxxxx" + Endpoint = "xxxxxx" + AccessKey = "xxxxxx" + SecretKey = "xxxxxx" ) var ( @@ -49,19 +49,19 @@ var ( func main() { // log to console os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new simpleConsumer instance - simpleConsumer, err := golang.NewSimpleConsumer(&golang.Config{ + simpleConsumer, err := rmq_client.NewSimpleConsumer(&rmq_client.Config{ Endpoint: Endpoint, - ConsumerGroup: GroupName, + ConsumerGroup: ConsumerGroup, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithAwaitDuration(awaitDuration), - golang.WithSubscriptionExpressions(map[string]*golang.FilterExpression{ - Topic: golang.SUB_ALL, + rmq_client.WithAwaitDuration(awaitDuration), + rmq_client.WithSubscriptionExpressions(map[string]*rmq_client.FilterExpression{ + Topic: rmq_client.SUB_ALL, }), ) if err != nil { diff --git a/golang/example/producer/async/main.go b/golang/example/producer/async/main.go index dde45dd..5a16047 100644 --- a/golang/example/producer/async/main.go +++ b/golang/example/producer/async/main.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) @@ -39,16 +39,16 @@ const ( func main() { // log to console os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new producer instance - producer, err := golang.NewProducer(&golang.Config{ + producer, err := rmq_client.NewProducer(&rmq_client.Config{ Endpoint: Endpoint, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithTopics(Topic), + rmq_client.WithTopics(Topic), ) if err != nil { log.Fatal(err) @@ -62,7 +62,7 @@ func main() { defer producer.GracefulStop() for i := 0; i < 10; i++ { // new a message - msg := &golang.Message{ + msg := &rmq_client.Message{ Topic: Topic, Body: []byte("this is a message : " + strconv.Itoa(i)), } @@ -70,7 +70,7 @@ func main() { msg.SetKeys("a", "b") msg.SetTag("ab") // send message in async - producer.SendAsync(context.TODO(), msg, func(ctx context.Context, resp []*golang.SendReceipt, err error) { + producer.SendAsync(context.TODO(), msg, func(ctx context.Context, resp []*rmq_client.SendReceipt, err error) { if err != nil { log.Fatal(err) } diff --git a/golang/example/producer/delay/main.go b/golang/example/producer/delay/main.go index c896cc3..8792c8e 100644 --- a/golang/example/producer/delay/main.go +++ b/golang/example/producer/delay/main.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) @@ -39,16 +39,16 @@ const ( func main() { // log to console os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new producer instance - producer, err := golang.NewProducer(&golang.Config{ + producer, err := rmq_client.NewProducer(&rmq_client.Config{ Endpoint: Endpoint, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithTopics(Topic), + rmq_client.WithTopics(Topic), ) if err != nil { log.Fatal(err) @@ -62,7 +62,7 @@ func main() { defer producer.GracefulStop() for i := 0; i < 10; i++ { // new a message - msg := &golang.Message{ + msg := &rmq_client.Message{ Topic: Topic, Body: []byte("this is a message : " + strconv.Itoa(i)), } diff --git a/golang/example/producer/fifo/main.go b/golang/example/producer/fifo/main.go index 816d299..4ecbed9 100644 --- a/golang/example/producer/fifo/main.go +++ b/golang/example/producer/fifo/main.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) @@ -39,16 +39,16 @@ const ( func main() { // log to console os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new producer instance - producer, err := golang.NewProducer(&golang.Config{ + producer, err := rmq_client.NewProducer(&rmq_client.Config{ Endpoint: Endpoint, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithTopics(Topic), + rmq_client.WithTopics(Topic), ) if err != nil { log.Fatal(err) @@ -62,7 +62,7 @@ func main() { defer producer.GracefulStop() for i := 0; i < 10; i++ { // new a message - msg := &golang.Message{ + msg := &rmq_client.Message{ Topic: Topic, Body: []byte("this is a message : " + strconv.Itoa(i)), } diff --git a/golang/example/producer/normal/main.go b/golang/example/producer/normal/main.go index d88ac01..7b0aa0e 100644 --- a/golang/example/producer/normal/main.go +++ b/golang/example/producer/normal/main.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) @@ -38,16 +38,16 @@ const ( func main() { os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new producer instance - producer, err := golang.NewProducer(&golang.Config{ + producer, err := rmq_client.NewProducer(&rmq_client.Config{ Endpoint: Endpoint, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithTopics(Topic), + rmq_client.WithTopics(Topic), ) if err != nil { log.Fatal(err) @@ -62,7 +62,7 @@ func main() { for i := 0; i < 10; i++ { // new a message - msg := &golang.Message{ + msg := &rmq_client.Message{ Topic: Topic, Body: []byte("this is a message : " + strconv.Itoa(i)), } diff --git a/golang/example/producer/transaction/main.go b/golang/example/producer/transaction/main.go index 09a5db1..2424008 100644 --- a/golang/example/producer/transaction/main.go +++ b/golang/example/producer/transaction/main.go @@ -25,7 +25,7 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang" + rmq_client "github.com/apache/rocketmq-clients/golang" "github.com/apache/rocketmq-clients/golang/credentials" ) @@ -39,22 +39,22 @@ const ( func main() { // log to console os.Setenv("mq.consoleAppender.enabled", "true") - golang.ResetLogger() + rmq_client.ResetLogger() // new producer instance - producer, err := golang.NewProducer(&golang.Config{ + producer, err := rmq_client.NewProducer(&rmq_client.Config{ Endpoint: Endpoint, Credentials: &credentials.SessionCredentials{ AccessKey: AccessKey, AccessSecret: SecretKey, }, }, - golang.WithTransactionChecker(&golang.TransactionChecker{ - Check: func(msg *golang.MessageView) golang.TransactionResolution { + rmq_client.WithTransactionChecker(&rmq_client.TransactionChecker{ + Check: func(msg *rmq_client.MessageView) rmq_client.TransactionResolution { log.Printf("check transaction message: %v", msg) - return golang.COMMIT + return rmq_client.COMMIT }, }), - golang.WithTopics(Topic), + rmq_client.WithTopics(Topic), ) if err != nil { log.Fatal(err) @@ -68,7 +68,7 @@ func main() { defer producer.GracefulStop() for i := 0; i < 10; i++ { // new a message - msg := &golang.Message{ + msg := &rmq_client.Message{ Topic: Topic, Body: []byte("this is a message : " + strconv.Itoa(i)), }
