Skip to content

Commit 634c22f

Browse files
committed
feat ( #33 ) : producer 추가
1 parent 44e1322 commit 634c22f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

  • casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/application/event/producer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package hs.kr.entrydsm.application.domain.application.event.producer
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper
4+
import hs.kr.entrydsm.application.domain.application.event.dto.CreateApplicationEvent
5+
import hs.kr.entrydsm.application.global.kafka.configuration.KafkaTopics
6+
import hs.kr.entrydsm.domain.application.interfaces.ApplicationCreateEventContract
7+
import org.springframework.kafka.core.KafkaTemplate
8+
import org.springframework.stereotype.Component
9+
import java.util.UUID
10+
11+
@Component
12+
class ApplicationEventProducer(
13+
private val mapper: ObjectMapper,
14+
private val createApplicationTemplate: KafkaTemplate<String, Any>
15+
): ApplicationCreateEventContract {
16+
17+
override fun publishCreateApplication(receiptCode: Long, userId: UUID) {
18+
val createApplicationEvent = CreateApplicationEvent(receiptCode, userId)
19+
createApplicationTemplate.send(
20+
KafkaTopics.CREATE_APPLICATION,
21+
mapper.writeValueAsString(createApplicationEvent)
22+
)
23+
}
24+
}

0 commit comments

Comments
 (0)