private volatile boolean done = false;
public SimpleProducer(String broker, String topic, String clientId)
+ {
+ this(broker, topic, clientId, null);
+ }
+
+ public SimpleProducer(String broker, String topic, String clientId, String transactionalId)
{
Properties props = new Properties();
props.put("bootstrap.servers", broker);
props.put("client.id", clientId); // Nur zur Wiedererkennung
- props.put("transactional.id", clientId); // Aktiviert außerdem enable.idempotence=true
+ if (transactionalId != null)
+ props.put("transactional.id", transactionalId); // Aktiviert außerdem enable.idempotence=true
props.put("key.serializer", StringSerializer.class.getName());
props.put("value.serializer", StringSerializer.class.getName());