diff --git a/examples/kafka-hub/hub/modules/persistence/persistence.bal b/examples/kafka-hub/hub/modules/persistence/persistence.bal index 41e48279..7ac8c6e2 100644 --- a/examples/kafka-hub/hub/modules/persistence/persistence.bal +++ b/examples/kafka-hub/hub/modules/persistence/persistence.bal @@ -60,8 +60,5 @@ isolated function produceKafkaMessage(string topicName, json payload, isolated function getProducerMsg(string topic, json payload, map headers) returns kafka:AnydataProducerRecord { byte[] value = payload.toJsonString().toBytes(); - if headers.length() == 0 { - return { topic, value }; - } - return { topic, value, headers }; + return headers.length() == 0 ? { topic, value } : { topic, value, headers }; }