What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

is there a place in documentation which describes good practices when it comes to error handling and

U01G4K5E0J2
U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

is there a place in documentation which describes good practices when it comes to error handling and reporting inside event listeners?
I'm asking this question because I have event listener which sends requests to an external API and would like to know what to do if API returns error response

Comments

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    I don't know if there's a general documentation for this behavior, but I'd stick to the Spryker defaults.
    This means: If anything goes wrong, throw an Exception with a usable error message and it's automatically dead-lettered to the *.error queue. That way, you can monitor the *.error queues and shovel the messages back and forth if need be.

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    thanks, this helped

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    do you know if this behavior is described somewhere?

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    No idea, but this is effectively how it works.

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    I wonder how this affects other listeners that might also be handling that events

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    and other events if I am using bulk handler

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    My best guess is that the processing is aborted and the message gets moved right away by the MessageProcessor.

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited February 2021

    Your event handlers should - in the best case - be idempotent (aka functional, stateless) so that they can be triggered anytime.

  • Andriy Netseplyayev
    Andriy Netseplyayev Domain Lead Solution Architecture Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    The only thing I was able to find in documentation is *Error Handling*. Plan for error handling during message processing such as routing to another queue, re-queuing, etc.

    throwing an Exception and thus sending the message into the β€œ*.error” queue is a default approach, however you can build a another message and send it to the custom queue for further processing and ack the original one, if you don’t want to interrupt further listeners