Why not execute through the @ PostConstruct consumption queue?

start a thread to consume the queue through @ PostConstruct.
I lost the message to the queue somewhere else, so why doesn"t while (true) consume it?

@PostConstruct
public void processOrder() {
    ExecutorService e = Executors.newFixedThreadPool(2);
    e.execute(() -> {
        while (true) {
            try {
                 /***/
                OrderMsg orderMsg = OrderMessageQueue.getQueue().consume();
                if (orderMsg != null) {
                    //
                    log.info("------------------------- {}-------------", orderMsg.getOrderId());
                    matchService.match(orderMsg.getOrderId(), orderMsg.getOrderId(), orderMsg.getOrderDirection());
                }
            } catch (InterruptedException ex) {
                log.error(ex.getMessage());
            }
        }
    });
   }
   :
   

clipboard.png

Menu