diff --git a/app/infrastructure/message-queue/src/main/java/org/example/adapter/ArtistCreateAdapter.java b/app/infrastructure/message-queue/src/main/java/org/example/adapter/ArtistCreateAdapter.java index 96d955dd..2b1d727c 100644 --- a/app/infrastructure/message-queue/src/main/java/org/example/adapter/ArtistCreateAdapter.java +++ b/app/infrastructure/message-queue/src/main/java/org/example/adapter/ArtistCreateAdapter.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.example.adapter.request.ArtistCreateInfraRequest; +import org.example.message.ArtistWithGenreCreateInfraMessage; import org.example.port.ArtistCreatePort; import org.example.port.dto.request.ArtistCreatePortRequest; import org.springframework.data.redis.core.RedisTemplate; @@ -17,10 +17,10 @@ public class ArtistCreateAdapter implements ArtistCreatePort { @Override public void createArtist(String topic, ArtistCreatePortRequest request) { - var infraMessage = ArtistCreateInfraRequest.from(request); + var infraMessage = ArtistWithGenreCreateInfraMessage.from(request); template.convertAndSend(topic, infraMessage); log.info("Message published successfully to topic: {}", topic); - log.info("Message Contents ( ArtistCreateInfraRequest : {})", infraMessage); + log.info("Message Contents ( ArtistWithGenreCreateInfraMessage : {})", infraMessage); } } diff --git a/app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistCreateInfraRequest.java b/app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistCreateInfraRequest.java deleted file mode 100644 index c673726c..00000000 --- a/app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistCreateInfraRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.example.adapter.request; - -import java.util.List; -import org.example.port.dto.request.ArtistCreatePortRequest; - -public record ArtistCreateInfraRequest( - List request -) { - - public static ArtistCreateInfraRequest from(ArtistCreatePortRequest request) { - return new ArtistCreateInfraRequest( - request.artists().stream().map(ArtistDomainInfraRequest::from).toList() - ); - } - -} diff --git a/app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistDomainInfraRequest.java b/app/infrastructure/message-queue/src/main/java/org/example/message/ArtistGenreDomainInfraMessage.java similarity index 67% rename from app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistDomainInfraRequest.java rename to app/infrastructure/message-queue/src/main/java/org/example/message/ArtistGenreDomainInfraMessage.java index b59d9bf5..1ab8b54f 100644 --- a/app/infrastructure/message-queue/src/main/java/org/example/adapter/request/ArtistDomainInfraRequest.java +++ b/app/infrastructure/message-queue/src/main/java/org/example/message/ArtistGenreDomainInfraMessage.java @@ -1,4 +1,4 @@ -package org.example.adapter.request; +package org.example.message; import java.util.List; import java.util.UUID; @@ -6,7 +6,7 @@ import org.example.port.dto.request.ArtistDomainPortRequest; @Builder -public record ArtistDomainInfraRequest( +public record ArtistGenreDomainInfraMessage( UUID id, String name, @@ -15,8 +15,8 @@ public record ArtistDomainInfraRequest( List genres ) { - public static ArtistDomainInfraRequest from(ArtistDomainPortRequest request) { - return ArtistDomainInfraRequest.builder() + public static ArtistGenreDomainInfraMessage from(ArtistDomainPortRequest request) { + return ArtistGenreDomainInfraMessage.builder() .id(request.id()) .name(request.name()) .image(request.image()) diff --git a/app/infrastructure/message-queue/src/main/java/org/example/message/ArtistWithGenreCreateInfraMessage.java b/app/infrastructure/message-queue/src/main/java/org/example/message/ArtistWithGenreCreateInfraMessage.java new file mode 100644 index 00000000..f6e399d4 --- /dev/null +++ b/app/infrastructure/message-queue/src/main/java/org/example/message/ArtistWithGenreCreateInfraMessage.java @@ -0,0 +1,16 @@ +package org.example.message; + +import java.util.List; +import org.example.port.dto.request.ArtistCreatePortRequest; + +public record ArtistWithGenreCreateInfraMessage( + List request +) { + + public static ArtistWithGenreCreateInfraMessage from(ArtistCreatePortRequest request) { + return new ArtistWithGenreCreateInfraMessage( + request.artists().stream().map(ArtistGenreDomainInfraMessage::from).toList() + ); + } + +}