diff --git a/src/main/java/fr/abes/kbart2kafka/service/FileService.java b/src/main/java/fr/abes/kbart2kafka/service/FileService.java index c0f2a45..f0b01e4 100644 --- a/src/main/java/fr/abes/kbart2kafka/service/FileService.java +++ b/src/main/java/fr/abes/kbart2kafka/service/FileService.java @@ -6,14 +6,10 @@ import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.producer.ProducerRecord; -import org.apache.kafka.common.header.Header; import org.apache.kafka.common.header.internals.RecordHeader; import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.support.KafkaHeaders; import org.springframework.kafka.support.SendResult; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.MessageBuilder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -84,7 +80,7 @@ private void executeMultiThread(File fichier, String kbartHeader) throws IOExcep executor.execute(() -> { try { List headers = new ArrayList<>(); - headers.add(new RecordHeader("FileName", kafkaHeader.getFileName().getBytes(StandardCharsets.UTF_8))); + headers.add(new RecordHeader("FileName", fichier.getName().getBytes(StandardCharsets.UTF_8))); headers.add(new RecordHeader("nbCurrentLines", String.valueOf(finalLineCounter).getBytes())); headers.add(new RecordHeader("nbLinesTotal", String.valueOf(nbLignesFichier).getBytes())); ProducerRecord record = new ProducerRecord<>(topicKbart, new Random().nextInt(nbThread), fichier.getName(), mapper.writeValueAsString(ligneKbartDto), headers);