Skip to content

Commit

Permalink
GH-1700: Reduce Method Complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Feb 11, 2021
1 parent bdd9ee8 commit 074f991
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ public void accept(ConsumerRecord<?, ?> record, @Nullable Consumer<?, ?> consume
ProducerRecord<Object, Object> outRecord = createProducerRecord(record, tp, headers,
kDeserEx == null ? null : kDeserEx.getData(), vDeserEx == null ? null : vDeserEx.getData());
KafkaOperations<Object, Object> kafkaTemplate = findTemplateForValue(outRecord.value());
send(outRecord, kafkaTemplate);
}

/**
* Send the record.
* @param outRecord the record.
* @param kafkaTemplate the template.
* @since 2.7
*/
protected void send(ProducerRecord<Object, Object> outRecord, KafkaOperations<Object, Object> kafkaTemplate) {
if (this.transactional && !kafkaTemplate.inTransaction() && !kafkaTemplate.isAllowNonTransactional()) {
kafkaTemplate.executeInTransaction(t -> {
publish(outRecord, t);
Expand Down

0 comments on commit 074f991

Please sign in to comment.