Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/639 handle policy expiration #1041

Conversation

ds-lcapellino
Copy link
Contributor

@ds-lcapellino ds-lcapellino commented Jun 17, 2024

Description

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

@ds-lcapellino ds-lcapellino force-pushed the feature/639-handle-policy-expiration branch from 471ce6b to 88b7fd5 Compare June 17, 2024 08:33
@@ -119,7 +119,7 @@ private String negotiateContractAgreement(final String receiverEdcUrl, final Cat
.orElseThrow()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the issue is that on the getCatalog call within the class NotificationsEdcFacade between line 157 and 164 we filter out all elements which are invalid.
Instead of filtering them out we need to catch them in a different exception.

e.g. PolicyExpiredException

This policy then will be cached again in EdcNotificationServiceImpl#handleSendingNotification, where we need to enrich the error message into the notification.

At the end we will have the info in the frontend that it was not possible to send it out due to policy issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PolicyCheckerService was adapted according to the requirements in issue #639. Please see eclipse-tractusx/item-relationship-service@6e8880b#diff-b63cc42711ba192e7a2ff818eaad3bf34984ebf1f30d53b2f5df2abfa468e623 fore reference.
This handles "NotificationsEdcFacade between line 157 and 164".

UsagePolicyExpiredException was also added: eclipse-tractusx/item-relationship-service@6e8880b#diff-3db264f1f24f39482d77c13221eaba18eba63de4620a7598ba4a1d404623e8ce
This is thrown, if the policy is expired during contract negotiation.

Copy link
Contributor

@ds-mwesener ds-mwesener Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the filter is gone. That is good. Still some things missing.

When the client library throws an exception within the contract negotiation (the point were you changed the exceptions) it will throw an exception and based on the logic of trace-x it will be catched and always mapped to the generic "NegotiationException" which is for our usage not enough.

We need to know if the policy was expired, or the policy constraints are incorrect or the policy is missing.

Therefore please catch those exceptions and pass them to the errorEnricher. To make sure we have that information in the frontend available.

If this is not manageable within the story - please recheck with product owner if new issue can be created for following up on that one.

Copy link
Contributor

@ds-mwesener ds-mwesener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adapt.

@ds-lcapellino
Copy link
Contributor Author

@ds-mwesener please re-review

.post("/api/notifications/{investigationId}/approve", investigationId)
.then()
.log().all()
.statusCode(503);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

503?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current implementation in case something fails, when trying to send notifications. Maybe HTTP 500 suits better

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion a 400 would match better, since the policy is part of a notification negotiation.

@ds-lcapellino ds-lcapellino force-pushed the feature/639-handle-policy-expiration branch from 6bf890e to e1eb275 Compare June 18, 2024 09:22
# Conflicts:
#	tx-backend/src/main/java/org/eclipse/tractusx/traceability/notification/domain/base/service/NotificationsEDCFacade.java
Copy link
Contributor

@ds-mwesener ds-mwesener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address comments.

Copy link
Contributor

@ds-mwesener ds-mwesener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ds-mwesener ds-mwesener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Contributor

@ds-mwesener ds-mwesener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ds-mwesener ds-mwesener merged commit f59fb36 into eclipse-tractusx:main Jul 3, 2024
16 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants