backend/src/main/java/com/magamochi/content/queue/consumer/MangaContentIngestConsumer.java

23 lines
858 B
Java

package com.magamochi.content.queue.consumer;
import com.magamochi.common.queue.command.MangaContentIngestCommand;
import com.magamochi.content.service.ContentIngestService;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;
@Log4j2
@Service
@RequiredArgsConstructor
public class MangaContentIngestConsumer {
private final ContentIngestService contentIngestService;
@RabbitListener(queues = "${queues.manga-content-ingest}")
public void receiveMangaContentIngestCommand(MangaContentIngestCommand command) {
log.info("Received manga content ingest command: {}", command);
contentIngestService.ingest(
command.mangaContentProviderId(), command.title(), command.url(), command.languageCode());
}
}