Java Magazine, Jan/Feb 2018
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2018 81 beyond CRUD For simplicity both the query and command services are using the same CoffeeOrders instance However this could be split into several components or systems and further optimized for each side accordingly For my purpose to show an example implementation this model is sufficient The connection for incoming events that trigger subsequent commands is done in the event handler This handler calls the command service for further processing of orders It both consumes Kafka messages and fires the corresponding CDI events @ Singleton @ Startup public class OrderEventHandler private EventConsumer eventConsumer @ Resource ManagedExecutorService mes @ Inject Properties kafkaProperties @ Inject Event CoffeeEvent events @ Inject OrderCommandService orderService @ Inject Logger logger public void handle@ Observes OrderBeansValidated event orderService acceptOrder event getOrderId
You must have JavaScript enabled to view digital editions.