Question: Workflow invoked via REST API

Hello,

I’m considering to utlize Axon for the new application.
Basically the logic is following:

  • the application receives data (about 1MB) via REST API
  • it stores the received data in AWS S3 bucket
  • processes the data
  • saves the result in ASW S3 bucket
  • sends the the processed data via SOAP into external system for processing
  • periodically polling the external system for result of processing

Since the flow involves external services I want to be able to retry if communication with external system fails.
Is Saga suitable for this scenario? Or would you reccommend another aproach?

Thanks

Pavel

Hi Pavel,

I think what your sketching can be regarded as a ‘complex business transaction’ with a notion of time tied into it, were you potentially want to perform counter action if the intended operation fails.
This is exactly what a Saga should be able to help you with.
Hence I’d say yes, I’d try out a Saga solution to your problem to model this complex business transaction.

Cheers,
Steven

Hi Pavel,

there are apparently two ways to read your question. When it comes to implementing the “workflow process”, yes, a Saga could be a suitable mechanism, as Steven points out. However, if you’re just looking for a solution to retry calls to external services, a Saga would be overkill. In that case, an (event) handler that invokes external services, in combination with an error handler on a (tracking) event processor should suffice.

Cheers,
Allard

Hi Steven and Allard,

thank you for your replies. It’s good to know that there is someone listening for developers questions :slight_smile:

Allard, actually I want both. I have already created simple proof of concept using saga and it seems that it is what I was looking for.

Now I’m only struggling with how to configure tracking processor. Could you please help?
I’m using Spring Boot 2.0.5, Axon 3.4 and JPA persistence using PostgreSQL.

Cheers

Pavel

Dne středa 7. listopadu 2018 14:56:22 UTC+1 Allard Buijze napsal(a):

Hi Pavel,

Glad to hear you’re happy to be heard :slight_smile:

To configure a tracking event processor, you could very harshly just switch the default to TrackingEventProcessor with the EventProcessingConfiguration#usingTrackingProcessors().

Note that in Axon 4, the default is the Tracking Event Processor.

If you’re still in the early development phase, I’d suggest to upgrade your project to Axon 4.

Cheers,
Steven

Hi Steven,

yes I’m in early stage of development so I updated to Axon 4 and it seems ok.

Thanks

Pavel

Dne čtvrtek 8. listopadu 2018 11:43:52 UTC+1 Steven van Beelen napsal(a):