Call external Api in Axon

Hello guys ,
I want to call an external api to update my projections with some informations with this api
so , my question is what is the better place to make this call in the command side or in projection side ?

It depends a bit on the use case. If you want the command to fail in case the call fails, you should do it on the command side, or with a subscribing event handler. If it can be asynchronous you can use a streaming event handler.

Since you mention updating a projection, it seems a streaming event handler would be the best in this case. By configuring it with a propagating error handler, it will keep retrying when the external call fails. At the same time the commands still continue to work. This is likely what you want.

Hi @Gerard

What do you means by streaming event handler ?

Streaming event processors are the default event processors. They work by reading from an event store. This decouples creating and storing the event from processing the event. Unlike a subscribing event processor where the event will be processed in the same transaction used to create and store the event.