Altinn / altinn-notifications

Altinn platform microservice for handling notifications (mail, sms, etc)
MIT License
2 stars 3 forks source link

Add send condition evaluation to order processing #549

Closed acn-sbuad closed 2 months ago

acn-sbuad commented 3 months ago

Description

547 convers the epic of supporting send conditions in notifications. A part of this is to evaluate the send condition using the condition during the processing of an order to decide if a notification should be sent or not.

The scope of this issue is to validate, accept/deny and persist the send condition endpoint along with the notification order.

Specification

Questions:

could a dialogue be read and deleted before the requested send time? if so what would the response of the send condition endpoint be? Strongly linked to dialogue element or to a persistent log?

Should condition be evaluated before or after a notification is generated?

To be more specific, if the send condition fails is the notification generated at all ? And if not, does the creator need to be made aware that the send condition failed? Is this then persisted in the order status?

If a notification IS NOT generated when condition fails

ACCEPTED Solution: We could consider adding a new status to the OrderProcessing status currently holds values Registered, Processing, Completed. We could add SendConditionNotMet.

Pros:

Cons:

If a notification IS generated when condition fails Solution: we could have a decorator shared between all order processing to lookup send condition to avoid duplication. Handling the buypass of lookup and going directly to generation of notification would need to be handled somehow. This is a need both with the decorator solution and not.

Pros:

Cons:

How are errors during condition lookups handled?

Fail fast

Pros:

Cons:

Retry

Pros:

Cons:

Manual intervention and responsibilities How do we want to split responsibility here. If service owner provides an endpoint (even via Dialogporten) they should be responsible for ensuring the endpoint is available. However, does Altinn have a responsibility to monitor the failures her and report back to them or do we simply register the failure on the order/notification as SendConditionEvaluationFailed or SendConditionNotEvaluated?

Do we need to manually re-set order status on error or can we expect the creator to place a new order?

Accepted solution

Tasks

Acceptance Criterias