3

5

fun handle(@Payload payload: ExportOrderMessage, message: Message) {
    try {
        val orderWithProducts = loadOrderWithProducts(payload.orderId)
        val business = db.findBusinessById(orderWithProducts.businessId)!!
        val businessContext = DatabaseLoadedBusinessContext({ business }, business.id!!)

        export(orderWithProducts, payload.targetConfig, businessContext)

        message.acknowledge()
    } catch (ex: Exception) {
        LOG.errorWithTrace("Failed to export {}", payload, ex)
    }
}
Made with Slides.com