Skip to content

Commit

Permalink
Supp variable de controle
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelQuetin committed May 22, 2024
1 parent a7c10b5 commit 308e1bb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/fr/abes/kafkatosudoc/kafka/KbartListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public class KbartListener {
private int nbNoticesParLot;

private final UtilsMapper mapper;

private AtomicInteger nb = new AtomicInteger(0);
private final BaconService baconService;

private final EmailService emailService;
Expand All @@ -82,7 +80,6 @@ public KbartListener(UtilsMapper mapper, BaconService baconService, EmailService
*/
@KafkaListener(topics = {"${topic.name.source.kbart.toload}"}, groupId = "${topic.groupid.source.withppn}", containerFactory = "kafkaKbartListenerContainerFactory", concurrency = "8")
public void listenKbartToCreateFromKafka(ConsumerRecord<String, LigneKbartConnect> lignesKbart) throws IOException {
// log.debug("Entrée dans création à partir du kbart " + nb.incrementAndGet());
String filename = lignesKbart.key();
if (!this.workInProgressMap.containsKey(filename)) {
this.workInProgressMap.put(filename, new WorkInProgress<>());
Expand All @@ -94,13 +91,13 @@ public void listenKbartToCreateFromKafka(ConsumerRecord<String, LigneKbartConnec
}


log.debug("(" + nb.incrementAndGet() + ") Current line : " + this.workInProgressMap.get(filename).incrementCurrentNbLignes() + " / total lines : " + this.workInProgressMap.get(filename).getNbLinesTotal());
if (lignesKbart.value().getBESTPPN() != null && !lignesKbart.value().getBESTPPN().isEmpty()) {
//on alimente la liste des notices d'un package qui sera traitée intégralement
this.workInProgressMap.get(filename).addNotice(lignesKbart.value());
}

//Si le nombre de lignes traitées est égal au nombre de lignes total du fichier, on est arrivé en fin de fichier, on traite dans le sudoc
log.debug("Current line : " + this.workInProgressMap.get(filename).incrementCurrentNbLignes() + " / total lines : " + this.workInProgressMap.get(filename).getNbLinesTotal());
if (this.workInProgressMap.get(filename).getCurrentNbLines().get() == (this.workInProgressMap.get(filename).getNbLinesTotal())) {
log.debug("Traitement des notices existantes dans le Sudoc à partir du kbart");
traiterPackageDansSudoc(this.workInProgressMap.get(filename).getListeNotices(), filename);
Expand Down

0 comments on commit 308e1bb

Please sign in to comment.