Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
wonwoo committed Nov 3, 2019
1 parent 76f643e commit b437485
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import ml.wonwoo.remote.product.HistoryRepository
import ml.wonwoo.remote.product.ProductType
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Component
import reactor.core.publisher.Mono
import java.time.LocalDateTime

@Component
class HistoryEventListener(private val historyRepository: HistoryRepository) {


@EventListener
fun onApplicationEvent(historyEvent: HistoryEvent) {
fun onApplicationEvent(historyEvent: HistoryEvent): Mono<Void> {

historyRepository.save(historyEvent.toEvent())
return historyRepository.save(historyEvent.toEvent()).then()

.subscribe()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BookController(private val bookRepository: BookRepository,

.map { it.dto() }
.doOnComplete {
applicationEventPublisher.publishEvent(HistoryEvent(name = name, productType = ProductType.MOVIE))
applicationEventPublisher.publishEvent(HistoryEvent(name = name, productType = ProductType.BOOK))
}
}
}
Expand Down

0 comments on commit b437485

Please sign in to comment.