From 8c3aa1161bfde799b131635848f18f1c73f174c8 Mon Sep 17 00:00:00 2001 From: ttimot24 Date: Fri, 20 Sep 2024 15:49:42 +0200 Subject: [PATCH] #46 - Small improvements --- .../keycloak/kafka/KafkaStandardProducerFactory.java | 4 ++-- .../snuk87/keycloak/kafka/mapper/KeycloakMapper.java | 9 ++++----- src/main/resources/avro/keycloak-admin-events-value.avsc | 2 +- src/main/resources/avro/keycloak-events-value.avsc | 2 +- .../keycloak/kafka/KeycloakEventAvroSerializerTest.java | 3 +-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/snuk87/keycloak/kafka/KafkaStandardProducerFactory.java b/src/main/java/com/github/snuk87/keycloak/kafka/KafkaStandardProducerFactory.java index d4018d4..22b75af 100644 --- a/src/main/java/com/github/snuk87/keycloak/kafka/KafkaStandardProducerFactory.java +++ b/src/main/java/com/github/snuk87/keycloak/kafka/KafkaStandardProducerFactory.java @@ -18,8 +18,8 @@ public Producer createProducer(String clientId, Stri Properties props = new Properties(); props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServer); props.put(ProducerConfig.CLIENT_ID_CONFIG, clientId); - props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, optionalProperties.getOrDefault(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName())); - props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, optionalProperties.getOrDefault(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class.getName())); + props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class.getName()); props.putAll(optionalProperties); return new KafkaProducer<>(props); diff --git a/src/main/java/com/github/snuk87/keycloak/kafka/mapper/KeycloakMapper.java b/src/main/java/com/github/snuk87/keycloak/kafka/mapper/KeycloakMapper.java index ec95d72..b4407f5 100644 --- a/src/main/java/com/github/snuk87/keycloak/kafka/mapper/KeycloakMapper.java +++ b/src/main/java/com/github/snuk87/keycloak/kafka/mapper/KeycloakMapper.java @@ -1,13 +1,12 @@ package com.github.snuk87.keycloak.kafka.mapper; -import com.github.snuk87.keycloak.kafka.dto.AuthDetails; -import com.github.snuk87.keycloak.kafka.dto.KeycloakAdminEvent; -import com.github.snuk87.keycloak.kafka.dto.KeycloakEvent; -import com.github.snuk87.keycloak.kafka.dto.OperationType; +import org.keycloak.kafka.dto.AuthDetails; +import org.keycloak.kafka.dto.KeycloakAdminEvent; +import org.keycloak.kafka.dto.KeycloakEvent; +import org.keycloak.kafka.dto.OperationType; import org.keycloak.events.Event; import org.keycloak.events.admin.AdminEvent; -import java.util.Map; import java.util.Optional; public class KeycloakMapper { diff --git a/src/main/resources/avro/keycloak-admin-events-value.avsc b/src/main/resources/avro/keycloak-admin-events-value.avsc index 82f722f..c2fb6eb 100644 --- a/src/main/resources/avro/keycloak-admin-events-value.avsc +++ b/src/main/resources/avro/keycloak-admin-events-value.avsc @@ -1,7 +1,7 @@ { "type": "record", "name": "KeycloakAdminEvent", - "namespace": "com.github.snuk87.keycloak.kafka.dto", + "namespace": "org.keycloak.kafka.dto", "fields": [ { "name": "authDetails", diff --git a/src/main/resources/avro/keycloak-events-value.avsc b/src/main/resources/avro/keycloak-events-value.avsc index 41d74f2..a28af17 100644 --- a/src/main/resources/avro/keycloak-events-value.avsc +++ b/src/main/resources/avro/keycloak-events-value.avsc @@ -1,7 +1,7 @@ { "type": "record", "name": "KeycloakEvent", - "namespace": "com.github.snuk87.keycloak.kafka.dto", + "namespace": "org.keycloak.kafka.dto", "fields": [ { "name": "clientId", diff --git a/src/test/java/com/github/snuk87/keycloak/kafka/KeycloakEventAvroSerializerTest.java b/src/test/java/com/github/snuk87/keycloak/kafka/KeycloakEventAvroSerializerTest.java index 66c932d..f800340 100644 --- a/src/test/java/com/github/snuk87/keycloak/kafka/KeycloakEventAvroSerializerTest.java +++ b/src/test/java/com/github/snuk87/keycloak/kafka/KeycloakEventAvroSerializerTest.java @@ -1,8 +1,7 @@ package com.github.snuk87.keycloak.kafka; -import com.github.snuk87.keycloak.kafka.dto.KeycloakAdminEvent; +import org.keycloak.kafka.dto.KeycloakAdminEvent; import org.apache.avro.Schema; -import org.apache.kafka.clients.admin.Admin; import org.junit.jupiter.api.Test; import io.confluent.kafka.schemaregistry.avro.AvroSchemaUtils; import org.keycloak.events.Event;