BewareMyPower commented on code in PR #1002:
URL: https://github.com/apache/pulsar-client-go/pull/1002#discussion_r1161505707


##########
pulsar/producer_partition.go:
##########
@@ -1067,6 +1108,20 @@ func (p *partitionProducer) SendAsync(ctx 
context.Context, msg *ProducerMessage,
 
 func (p *partitionProducer) internalSendAsync(ctx context.Context, msg 
*ProducerMessage,
        callback func(MessageID, *ProducerMessage, error), flushImmediately 
bool) {
+       //Register transaction operation to transaction and the transaction 
coordinator.
+       if msg.Transaction != nil {
+               transactionImpl := (msg.Transaction).(*transaction)
+
+               err := transactionImpl.registerProducerTopic(p.topic)
+               if err != nil {
+                       callback(nil, msg, err)
+                       return
+               }
+               err = transactionImpl.registerSendOrAckOp()
+               if err != nil {

Review Comment:
   ```suggestion
                if err := transactionImpl.registerSendOrAckOp(); err != nil {
   ```
   
   Simplify the code



##########
pulsar/producer_partition.go:
##########
@@ -1067,6 +1108,20 @@ func (p *partitionProducer) SendAsync(ctx 
context.Context, msg *ProducerMessage,
 
 func (p *partitionProducer) internalSendAsync(ctx context.Context, msg 
*ProducerMessage,
        callback func(MessageID, *ProducerMessage, error), flushImmediately 
bool) {
+       //Register transaction operation to transaction and the transaction 
coordinator.
+       if msg.Transaction != nil {
+               transactionImpl := (msg.Transaction).(*transaction)

Review Comment:
   Should we check if the state of `msg.Transaction` is `TxnOpen` here?



-- 
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: commits-unsubscr...@pulsar.apache.org

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

Reply via email to