title: TransactionId prefix for producer-only and read-process-write - ProducerFencedException
body: <p>Background: We have been getting ProducerFencedException in our producer-only transactions, and want to introduce uniqueness to our prefix to prevent this issue.</p>
  
  <p>In this discussion, Gary mentions that in the case of read-process-write, the prefix must be the same in all instances and after each restart.
  <a href="https://stackoverflow.com/questions/57179169/how-to-choose-kafka-transaction-id-for-several-applications-hosted-in-kubernete">How to choose Kafka transaction id for several applications, hosted in Kubernetes?</a></p>
  
  <p>While digging into this issue, I came to the realisation that we are sharing the same prefixId for both producer-only and read-process-write.</p>
  
  <p>In our TopicPublisher class wrapping kafkaTemplate, we already have a publish() and publishInTransaction() methods for read-process-write and producer-only use cases respectively.</p>
  
  <p>I am thinking to have 2 sets of kafkaTemplates/TransactionManagers/ProducerFactories, one with a fixed prefixId to be used by the publish() method and one with a unique prefix to be used in publishInTransaction().</p>
  
  <p>My question is:</p>
  
  <ul>
  <li><p>Does the prefix for producer-only need to be the same after a pod is restarted. Can we just append some uuid or k8s podId? Someone mentioned there may be delays with aborting transactions.</p></li>
  <li><p>Is there a clean way to detect if the TopicPublisher is being called from a KafkaListener, so we can have just 1 publish method that uses the correct kafkaTemplate as needed?</p></li>
  </ul>