Saga issues (not sending events)

Hi,

I’m trying testing saga with Axon version 4 and I didn’t found any example with separated microservice.

Trying to do that my Saga isn’t sending the events I’m using spring boot and axonserver.

@Saga
public class GiftCardPaymentSaga {

private final Logger LOG = LoggerFactory.getLogger(GiftCardPaymentSaga.class);

public GiftCardPaymentSaga() { }

@Autowired
private CommandGateway commandGateway;

@StartSaga
@SagaEventHandler(associationProperty = “giftCardId”)
public void handle(PaymentedEvt event) {
if (event.getCard().equals(“0”)) { //mocking to test
SagaLifecycle.associateWith(“giftCardId”, event.getGiftCardId().toString());
commandGateway.send(new GiftCardPaymentConfirmedEvent(event.getGiftCardId(), event.getCard()));
}
}

@EndSaga
@SagaEventHandler(associationProperty = “giftCardId”)
public void handle(GiftCardPaymentConfirmedEvent event) {
LOG.info("account removed {}, customer {} ", event.getGiftCardId(), event.getCard());
}

@EndSaga
@SagaEventHandler(associationProperty = “giftCardId”)
public void handle(GiftCardPaymentDeniedEvent event) {
LOG.info("account can’t be removed {}, customer {} ", event.getGiftCardId(), event.getCard());
}

}

After executing the code, shows a warn at console and my events is not fired.

2018-12-18 11:08:58.442 WARN 2563 — [ault-executor-0] o.a.c.gateway.DefaultCommandGateway : Command ‘com.giftcard.query.listener.GiftCardPaymentConfirmedEvent’ resulted in org.axonframework.axonserver.connector.command.AxonServerRemoteCommandHandlingException(An exception was thrown by the remote message handling component.)

Hi Gustavo,

in Axon 4.0.3, the exception message has become slightly more descriptive, which makes it easier to debug.
However, looking at “Command 'com.giftcard.query.listener.GiftCardPaymentConfirmedEvent”, I suspect the problem is caused by a NoHandlerForCommandException, as your “Command” has the suffix “Event”. Are you sending an event on the command bus?

Cheers,

Allard

I changed my command name to not have the “Event” sufix and didn’t worked.

Can I put any debug flag in order to get more descriptive?

Hi Gustavo,

In your first message you’re pointing out you’re testing this GiftCardPaymentSaga.
Are you actually using SagaTestFixtures for this or are you testing by starting up the application?

If you would be testing the Saga instance through the SagaTestFixtures, I would assume the ‘NoHandlerForCommandException’ would never be thrown at all.

Hence, I am assuming you’re ‘testing’ in a live system.
In that case, the changes are high that the application which should handle the ‘GiftCardPaymentConfirmedEvent’ (which should be a command message if you publish it on the gateway by the way) either does not correctly declare a Command Handling method for that command or the application isn’t correctly connected to Axon Server.
You can start up Axon Server with debug logging if you’d want, by setting logging.level.root=DEBUG for example.

Let’s try to resolve your issue Gustavo, hope this helps a little already.

Cheers,
Steven