BartMiki commented on code in PR #12915:
URL: https://github.com/apache/druid/pull/12915#discussion_r952203456
##########
extensions-contrib/kafka-emitter/src/main/java/org/apache/druid/emitter/kafka/KafkaEmitter.java:
##########
@@ -166,14 +169,14 @@ private void sendToKafka(final String topic,
MemoryBoundLinkedBlockingQueue<Stri
public void emit(final Event event)
{
if (event != null) {
- ImmutableMap.Builder<String, Object> resultBuilder =
ImmutableMap.<String, Object>builder().putAll(event.toMap());
- if (config.getClusterName() != null) {
- resultBuilder.put("clusterName", config.getClusterName());
- }
- Map<String, Object> result = resultBuilder.build();
-
try {
- String resultJson = jsonMapper.writeValueAsString(result);
+ EventMap map = event.toMap();
+ if (config.getClusterName() != null) {
+ map.put("clusterName", config.getClusterName());
Review Comment:
I can replace EventMap to extend the ImmutableMap instead of HashMap, what
do you think? Then it will be always immutable on the output.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]