From faf12a2185207205d33c6565eae978d774271dba Mon Sep 17 00:00:00 2001 From: "kaiyi.lk" Date: Tue, 7 Feb 2023 19:51:17 +0800 Subject: [PATCH] v5.0.2-rc-golang --- golang/client.go | 8 ++--- golang/client_manager.go | 6 ++-- golang/client_manager_mock.go | 2 +- golang/client_manager_test.go | 2 +- golang/client_mock.go | 2 +- golang/client_options.go | 2 +- golang/client_test.go | 2 +- golang/config.go | 2 +- golang/conn.go | 2 +- golang/conn_options.go | 2 +- golang/consumer.go | 2 +- golang/error.go | 2 +- .../example/consumer/simple_consumer/main.go | 4 +-- golang/example/producer/async/main.go | 4 +-- golang/example/producer/delay/main.go | 4 +-- golang/example/producer/fifo/main.go | 4 +-- golang/example/producer/normal/main.go | 4 +-- golang/example/producer/transaction/main.go | 4 +-- golang/go.mod | 2 +- golang/loadBalancer.go | 4 +-- golang/log.go | 2 +- golang/message.go | 4 +-- golang/message_id_codec.go | 35 ++++++++++--------- golang/metric.go | 4 +-- golang/pkg/grpc/middleware/zaplog/zaplog.go | 2 +- golang/pkg/utils/utils.go | 4 +-- golang/pkg/utils/utils_test.go | 2 +- golang/producer.go | 4 +-- golang/producer_options.go | 2 +- golang/producer_test.go | 4 +-- golang/publishing_message.go | 4 +-- golang/rpc_client.go | 2 +- golang/rpc_client_mock.go | 2 +- golang/simple_consumer.go | 4 +-- golang/simple_consumer_options.go | 2 +- golang/user_agent.go | 4 +-- 36 files changed, 73 insertions(+), 72 deletions(-) diff --git a/golang/client.go b/golang/client.go index 2b95f2bcb..a47696035 100644 --- a/golang/client.go +++ b/golang/client.go @@ -28,10 +28,10 @@ import ( "sync" "time" - innerMD "github.com/apache/rocketmq-clients/golang/metadata" - "github.com/apache/rocketmq-clients/golang/pkg/ticker" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + innerMD "github.com/apache/rocketmq-clients/golang/v5/metadata" + "github.com/apache/rocketmq-clients/golang/v5/pkg/ticker" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "github.com/google/uuid" "go.uber.org/atomic" "go.uber.org/zap" diff --git a/golang/client_manager.go b/golang/client_manager.go index 44e71a14b..8432d5c5c 100644 --- a/golang/client_manager.go +++ b/golang/client_manager.go @@ -22,9 +22,9 @@ import ( "sync" "time" - "github.com/apache/rocketmq-clients/golang/pkg/ticker" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/ticker" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/golang/client_manager_mock.go b/golang/client_manager_mock.go index f0d4d7647..e5eb7b90d 100644 --- a/golang/client_manager_mock.go +++ b/golang/client_manager_mock.go @@ -22,7 +22,7 @@ import ( reflect "reflect" time "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/golang/client_manager_test.go b/golang/client_manager_test.go index 6d794c81e..e81c1525c 100644 --- a/golang/client_manager_test.go +++ b/golang/client_manager_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" gomock "github.com/golang/mock/gomock" "github.com/prashantv/gostub" "google.golang.org/grpc/metadata" diff --git a/golang/client_mock.go b/golang/client_mock.go index 58d27aef4..8205b1066 100644 --- a/golang/client_mock.go +++ b/golang/client_mock.go @@ -21,7 +21,7 @@ import ( context "context" reflect "reflect" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/golang/client_options.go b/golang/client_options.go index ad1a75103..4db37f3a5 100644 --- a/golang/client_options.go +++ b/golang/client_options.go @@ -20,7 +20,7 @@ package golang import ( "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" ) type clientOptions struct { diff --git a/golang/client_test.go b/golang/client_test.go index 5265a7630..0372490ba 100644 --- a/golang/client_test.go +++ b/golang/client_test.go @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/apache/rocketmq-clients/golang/credentials" + "github.com/apache/rocketmq-clients/golang/v5/credentials" gomock "github.com/golang/mock/gomock" "github.com/prashantv/gostub" ) diff --git a/golang/config.go b/golang/config.go index 42ead577d..fdb04165c 100644 --- a/golang/config.go +++ b/golang/config.go @@ -17,7 +17,7 @@ package golang -import "github.com/apache/rocketmq-clients/golang/credentials" +import "github.com/apache/rocketmq-clients/golang/v5/credentials" type Config struct { Endpoint string `validate:"required"` diff --git a/golang/conn.go b/golang/conn.go index eeca8a0ce..75b30b62c 100644 --- a/golang/conn.go +++ b/golang/conn.go @@ -22,7 +22,7 @@ import ( "errors" "fmt" - "github.com/apache/rocketmq-clients/golang/pkg/grpc/middleware/zaplog" + "github.com/apache/rocketmq-clients/golang/v5/pkg/grpc/middleware/zaplog" validator "github.com/go-playground/validator/v10" "google.golang.org/grpc" "google.golang.org/grpc/credentials" diff --git a/golang/conn_options.go b/golang/conn_options.go index 0c0e7cc08..2f59432d5 100644 --- a/golang/conn_options.go +++ b/golang/conn_options.go @@ -24,7 +24,7 @@ import ( "math" "time" - "github.com/apache/rocketmq-clients/golang/pkg/zaplog" + "github.com/apache/rocketmq-clients/golang/v5/pkg/zaplog" "go.uber.org/zap" "google.golang.org/grpc" ) diff --git a/golang/consumer.go b/golang/consumer.go index b2d9596bc..2be5a7f5a 100644 --- a/golang/consumer.go +++ b/golang/consumer.go @@ -20,7 +20,7 @@ package golang import ( "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" ) type Consumer interface { diff --git a/golang/error.go b/golang/error.go index 06fa590f1..632634da6 100644 --- a/golang/error.go +++ b/golang/error.go @@ -21,7 +21,7 @@ import ( "errors" "fmt" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" ) type ErrRpcStatus struct { diff --git a/golang/example/consumer/simple_consumer/main.go b/golang/example/consumer/simple_consumer/main.go index f53dedc52..6b1b974ae 100644 --- a/golang/example/consumer/simple_consumer/main.go +++ b/golang/example/consumer/simple_consumer/main.go @@ -24,8 +24,8 @@ import ( "os" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/example/producer/async/main.go b/golang/example/producer/async/main.go index dfebe18b7..7190b8602 100644 --- a/golang/example/producer/async/main.go +++ b/golang/example/producer/async/main.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/example/producer/delay/main.go b/golang/example/producer/delay/main.go index 947dc2f30..42b376ef9 100644 --- a/golang/example/producer/delay/main.go +++ b/golang/example/producer/delay/main.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/example/producer/fifo/main.go b/golang/example/producer/fifo/main.go index 2aa8443e9..48229ba6c 100644 --- a/golang/example/producer/fifo/main.go +++ b/golang/example/producer/fifo/main.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/example/producer/normal/main.go b/golang/example/producer/normal/main.go index 2f5bcb660..cc2916f7c 100644 --- a/golang/example/producer/normal/main.go +++ b/golang/example/producer/normal/main.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/example/producer/transaction/main.go b/golang/example/producer/transaction/main.go index 584a7700e..f46d22779 100644 --- a/golang/example/producer/transaction/main.go +++ b/golang/example/producer/transaction/main.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - rmq_client "github.com/apache/rocketmq-clients/golang" - "github.com/apache/rocketmq-clients/golang/credentials" + rmq_client "github.com/apache/rocketmq-clients/golang/v5" + "github.com/apache/rocketmq-clients/golang/v5/credentials" ) const ( diff --git a/golang/go.mod b/golang/go.mod index 63e971f14..921328b33 100644 --- a/golang/go.mod +++ b/golang/go.mod @@ -1,4 +1,4 @@ -module github.com/apache/rocketmq-clients/golang +module github.com/apache/rocketmq-clients/golang/v5 go 1.17 diff --git a/golang/loadBalancer.go b/golang/loadBalancer.go index 385b06531..db9cbd44a 100644 --- a/golang/loadBalancer.go +++ b/golang/loadBalancer.go @@ -22,8 +22,8 @@ import ( "sync" "sync/atomic" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "github.com/dchest/siphash" // "github.com/dchest/siphash" ) diff --git a/golang/log.go b/golang/log.go index 31d3e7fae..a835ac63c 100644 --- a/golang/log.go +++ b/golang/log.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - "github.com/apache/rocketmq-clients/golang/pkg/utils" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" "github.com/natefinch/lumberjack" "go.uber.org/zap" "go.uber.org/zap/zapcore" diff --git a/golang/message.go b/golang/message.go index 4c16ba6fc..00586b18c 100644 --- a/golang/message.go +++ b/golang/message.go @@ -25,8 +25,8 @@ import ( "strconv" "time" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/golang/message_id_codec.go b/golang/message_id_codec.go index 01a16fa8b..1398c35e1 100644 --- a/golang/message_id_codec.go +++ b/golang/message_id_codec.go @@ -27,10 +27,11 @@ import ( "sync/atomic" "time" - "github.com/apache/rocketmq-clients/golang/pkg/utils" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" ) -/** +/* +* The codec for the message-id. Codec here provides the following two functions: @@ -44,26 +45,26 @@ number. For V1, these two bytes are 0x0001. V1 message id example - ┌──┬────────────┬────┬────────┬────────┐ - │01│56F7E71C361B│21BC│024CCDBE│00000000│ - └──┴────────────┴────┴────────┴────────┘ - + ┌──┬────────────┬────┬────────┬────────┐ + │01│56F7E71C361B│21BC│024CCDBE│00000000│ + └──┴────────────┴────┴────────┴────────┘ V1 version message id generation rules - process id(lower 2bytes) - ▲ + process id(lower 2bytes) + ▲ + mac address(lower 6bytes) │ sequence number(big endian) - ▲ │ ▲ (4bytes) - │ │ │ - ┌─────┴─────┐ ┌┴┐ ┌───┐ ┌─┴─┐ - 0x01+ │ 6 │ │2│ │ 4 │ │ 4 │ - └───────────┘ └─┘ └─┬─┘ └───┘ - │ - ▼ - seconds since 2021-01-01 00:00:00(UTC+0) - (lower 4bytes) + ▲ │ ▲ (4bytes) + │ │ │ + ┌─────┴─────┐ ┌┴┐ ┌───┐ ┌─┴─┐ + 0x01+ │ 6 │ │2│ │ 4 │ │ 4 │ + └───────────┘ └─┘ └─┬─┘ └───┘ + │ + ▼ + seconds since 2021-01-01 00:00:00(UTC+0) + (lower 4bytes) */ type MessageIdCodec interface { NextMessageId() MessageId diff --git a/golang/metric.go b/golang/metric.go index 464b91a2c..1be579fc9 100644 --- a/golang/metric.go +++ b/golang/metric.go @@ -23,8 +23,8 @@ import ( "time" "contrib.go.opencensus.io/exporter/ocagent" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "go.opencensus.io/stats" "go.opencensus.io/stats/view" "go.opencensus.io/tag" diff --git a/golang/pkg/grpc/middleware/zaplog/zaplog.go b/golang/pkg/grpc/middleware/zaplog/zaplog.go index bd7b0a296..556497783 100644 --- a/golang/pkg/grpc/middleware/zaplog/zaplog.go +++ b/golang/pkg/grpc/middleware/zaplog/zaplog.go @@ -21,7 +21,7 @@ import ( "context" "time" - "github.com/apache/rocketmq-clients/golang/pkg/zaplog/ctxzap" + "github.com/apache/rocketmq-clients/golang/v5/pkg/zaplog/ctxzap" "go.uber.org/zap" "google.golang.org/grpc" diff --git a/golang/pkg/utils/utils.go b/golang/pkg/utils/utils.go index d07e60eb6..76be79353 100644 --- a/golang/pkg/utils/utils.go +++ b/golang/pkg/utils/utils.go @@ -33,8 +33,8 @@ import ( "sync/atomic" "time" - "github.com/apache/rocketmq-clients/golang/metadata" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/metadata" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "github.com/valyala/fastrand" "go.opencensus.io/trace" MD "google.golang.org/grpc/metadata" diff --git a/golang/pkg/utils/utils_test.go b/golang/pkg/utils/utils_test.go index eca670c2d..c26f8c4f0 100644 --- a/golang/pkg/utils/utils_test.go +++ b/golang/pkg/utils/utils_test.go @@ -21,7 +21,7 @@ import ( "compress/gzip" "testing" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" ) func TestMod(t *testing.T) { diff --git a/golang/producer.go b/golang/producer.go index c3ad9929a..54e9412f1 100644 --- a/golang/producer.go +++ b/golang/producer.go @@ -24,8 +24,8 @@ import ( "sync" "time" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/durationpb" ) diff --git a/golang/producer_options.go b/golang/producer_options.go index 445a2d38c..fd9ba29a4 100644 --- a/golang/producer_options.go +++ b/golang/producer_options.go @@ -22,7 +22,7 @@ import ( "sync" "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/durationpb" ) diff --git a/golang/producer_test.go b/golang/producer_test.go index 2902eaa15..7e45271f9 100644 --- a/golang/producer_test.go +++ b/golang/producer_test.go @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/apache/rocketmq-clients/golang/credentials" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/credentials" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" gomock "github.com/golang/mock/gomock" "github.com/prashantv/gostub" ) diff --git a/golang/publishing_message.go b/golang/publishing_message.go index 5ce685435..dbf8d2fe9 100644 --- a/golang/publishing_message.go +++ b/golang/publishing_message.go @@ -20,8 +20,8 @@ package golang import ( "fmt" - innerOS "github.com/apache/rocketmq-clients/golang/pkg/os" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + innerOS "github.com/apache/rocketmq-clients/golang/v5/pkg/os" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/golang/rpc_client.go b/golang/rpc_client.go index 5ea838ebb..98e6863dc 100644 --- a/golang/rpc_client.go +++ b/golang/rpc_client.go @@ -25,7 +25,7 @@ import ( "sync/atomic" "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" // "google.golang.org/protobuf/types/known/durationpb" ) diff --git a/golang/rpc_client_mock.go b/golang/rpc_client_mock.go index 0cd2372cf..a01ce9bd0 100644 --- a/golang/rpc_client_mock.go +++ b/golang/rpc_client_mock.go @@ -22,7 +22,7 @@ import ( reflect "reflect" time "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" gomock "github.com/golang/mock/gomock" ) diff --git a/golang/simple_consumer.go b/golang/simple_consumer.go index 43443ffd2..c6918f55e 100644 --- a/golang/simple_consumer.go +++ b/golang/simple_consumer.go @@ -25,8 +25,8 @@ import ( "sync/atomic" "time" - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/golang/simple_consumer_options.go b/golang/simple_consumer_options.go index 2f919e928..09ad1d7e7 100644 --- a/golang/simple_consumer_options.go +++ b/golang/simple_consumer_options.go @@ -21,7 +21,7 @@ import ( "fmt" "time" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" "google.golang.org/protobuf/types/known/durationpb" ) diff --git a/golang/user_agent.go b/golang/user_agent.go index 012f532a8..fd3c88c2d 100644 --- a/golang/user_agent.go +++ b/golang/user_agent.go @@ -18,8 +18,8 @@ package golang import ( - "github.com/apache/rocketmq-clients/golang/pkg/utils" - v2 "github.com/apache/rocketmq-clients/golang/protocol/v2" + "github.com/apache/rocketmq-clients/golang/v5/pkg/utils" + v2 "github.com/apache/rocketmq-clients/golang/v5/protocol/v2" ) type userAgent struct {