Skip to main content

Errors

Architecture In Hii Retail

The architecture used in Hii Retail is Event-Driven and Reactive. This means that data is eventually consistent and the internal services react to events happening in other systems.

There are many benefits with this architecture, and one of them is that each service can alert about its own problems.

Example: "Faulty data" (Business Unit Id does not exist (545534)) is sent to the Item input API- The caller of the API receives 202 - Accepted as a response. This data will be calculated and distributed to all downstream systems, but the downstream service called Store Data would not find the Business Unit with this ID. They could still store the data, and keep it for "eventual consistency", but typically they would make an alert the the External Events system that explains what has happened: "Data for Business Unit 545534 received. This Business Unit is not present. Please check your data!"

The benefit is that the data has been stored and made available to many other systems in the meantime, and when the missing Business Unit is added, the Store Data service can distribute the data as expected.

Errors

We generally talk about 2 types of errors - Synchronous errors that happen immediately when something goes wrong and asynchronous errors that happen after some action has been triggered.

Synchronous errors

Synchronous errors are errors that you will receive immediately when trying to send data to Hii Retail. This might be due to missing required content, wrong or expired token, missing access roles or even faulty content in some services. These errors are listed in each API as possible response codes. Please see each individual API for details.

Asynchronous errors

The architecture in Hii Retail allows us to operate and scale more fluently, even when errors occur. Unexpected errors in the data flow will be handled in so called Dead Letter Queues, where the data causing the error is stored in a separate storage bucket for automatic or manual processing. This also means that the integration will inform about errors in an asynchronous way to the callers of the APIs.

What one system considered an error might not be an error in another, so this loose coupling and eventual consistency allows systems to be operational even if one is having a problem.

Hence it is important that you as the consumer of Hii Retail APIs make sure to subscribe to the External Event service for alerts.