zjykzk commented on a change in pull request #13: Implementing SendMessageOneway
URL: https://github.com/apache/rocketmq-client-go/pull/13#discussion_r242116446
##########
File path: core/push_consumer.go
##########
@@ -169,10 +167,20 @@ func newPushConsumer(config *PushConsumerConfig)
(PushConsumer, error) {
}
}
- code = int(C.SetPushConsumerMessageModel(cconsumer,
(C.CMessageModel)(config.Model)))
+ if config.Model != 0 {
+ var mode C.CMessageModel
+ switch config.Model {
+ case BroadCasting:
+ mode = C.BROADCASTING
+ case Clustering:
+ mode = C.CLUSTERING
+ }
+ code = int(C.SetPushConsumerMessageModel(cconsumer, mode))
+
+ if code != 0 {
+ return nil, errors.New(fmt.Sprintf("PushConsumer Set
ConsumerMessageModel error, code is: %d", int(code)))
Review comment:
`fmt.Errorf` is simpler
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services