def transaction
      raise 'This method requires a block' unless block_given?
      begin_transaction
      yield
      commit_transaction
    rescue Kafka::Producer::AbortTransaction
      abort_transaction
    rescue
      abort_transaction
      raise
    end
def transaction
      raise 'This method requires a block' unless block_given?
      begin_transaction
      yield
      commit_transaction
    rescue Kafka::Producer::AbortTransaction
      abort_transaction
    rescue
      abort_transaction
      raise
    end
Syntactic sugar to enable easier transaction usage. Do the following steps

 - Start the transaction (with Producer#begin_transaction)
 - Yield the given block
 - Commit the transaction (with Producer#commit_transaction)

 If the block raises exception, the transaction is automatically aborted
 *before* bubble up the exception.

 If the block raises Kafka::Producer::AbortTransaction indicator exception,
 it aborts the transaction silently, without throwing up that exception.

 @return [nil]