Support allowNonTransactional config

Add a new producer extended property for allowNonTransactional.
When set to true, records published to this output binding will
not be run in a transaction, unless one is already in process.

By default, all ouput bindings associated with a transactional
binder publishes in a new transaction. This new property can be
used to override this behavior.

Addressing PR review comments.

Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/990
This commit is contained in:
Soby Chacko
2020-12-03 16:57:54 -05:00
committed by Gary Russell
parent 5a7cc9f257
commit a1b31e67c4
4 changed files with 46 additions and 0 deletions

View File

@@ -105,6 +105,11 @@ public class KafkaProducerProperties {
*/
private int closeTimeout;
/**
* Set to true to disable transactions.
*/
private boolean allowNonTransactional;
/**
* @return buffer size
*
@@ -279,6 +284,14 @@ public class KafkaProducerProperties {
this.closeTimeout = closeTimeout;
}
public boolean isAllowNonTransactional() {
return this.allowNonTransactional;
}
public void setAllowNonTransactional(boolean allowNonTransactional) {
this.allowNonTransactional = allowNonTransactional;
}
/**
* Enumeration for compression types.
*/