Internal events cannot be consumed in spring boot. Only when using Kafka Consume

20 views Asked by At

In spring boot, The same method is used, in the controller, an internal event is issued and the consummation succeeds, but in the kafka event handler that comes from outside, the internal event execution fails.

The event uses @transactionalEventListener to operate only when the transaction ends normally.

The service's internal logic is performed normally, but internally issued events are not consumed.

Does anyone know anything about this issue?

The code below is the consumer part.

    public Consumer<Message<CustomerStatusEvent>> customerStatus() {

        return customerStatusEventMessage -> { 
        service.doBusinessLogic(); //It has @trasactional
    }
}

The code below is the internal event handler part.

    @Async
    @TransactionalEventListener
    public void doInternalMethod(BusinessEvent event) {
       //do internal method
    }

Events are issued through registerEvent() in the JPA entity.

0

There are 0 answers