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

core: dispatch ContractNegotiation events #1609

Merged
merged 3 commits into from
Jul 11, 2022
Merged

core: dispatch ContractNegotiation events #1609

merged 3 commits into from
Jul 11, 2022

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Jul 7, 2022

What this PR changes/adds

Dispatch ContractNegotiation events

Why it does that

To permit asynchronous notifications

Further notes

  • rename the event listeners in <entity name>EventListener
  • Add a getFailureDetail() method on the AbstractResult class, that provides a join of all the failure messages without having to do it every time
  • Bump awaitility to 4.2.0

Linked Issue(s)

Closes #1434

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • added relevant details to the changelog? (skip with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

Copy link
Member

@paullatzelsperger paullatzelsperger left a comment

Choose a reason for hiding this comment

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

I noticed that ConfirmedContractNegotiationListener and
DeclinedContractNegotiationListener are unused, so they can be removed. This then makes the pre--methods of the ContractNegotiationListener obsolete as there no implementors left anymore.

@ndr-brt ndr-brt requested a review from juliapampus as a code owner July 8, 2022 06:50
@ndr-brt
Copy link
Member Author

ndr-brt commented Jul 8, 2022

@paullatzelsperger I think the pre- action methods are used by some implementors, as we discussed a lot about this especially with @algattik and @ouphi .
I would suggest to remove this pre- methods once the event system will get the persistence in a transactional context with the state change, doing that we're sure that every state change will have its own event (without the risk of losing them), this will enable audit on them.
Just some ideas dropped here, we'd need to discuss if this is really needed and how it should be done.

@ndr-brt ndr-brt requested a review from ronjaquensel July 8, 2022 07:27
@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2022

Codecov Report

Merging #1609 (4086613) into main (93f4b0c) will increase coverage by 0.38%.
The diff coverage is 64.93%.

@@            Coverage Diff             @@
##             main    #1609      +/-   ##
==========================================
+ Coverage   67.30%   67.69%   +0.38%     
==========================================
  Files         771      779       +8     
  Lines       16599    16731     +132     
  Branches     1051     1051              
==========================================
+ Hits        11172    11326     +154     
+ Misses       4945     4923      -22     
  Partials      482      482              
Impacted Files Coverage Δ
...ract/validation/ContractValidationServiceImpl.java 61.53% <0.00%> (ø)
...connector/transfer/core/CoreTransferExtension.java 0.00% <0.00%> (ø)
...er/core/listener/TransferProcessEventListener.java 0.00% <0.00%> (ø)
...gotiation/observe/ContractNegotiationListener.java 0.00% <0.00%> (ø)
.../dataspaceconnector/spi/result/AbstractResult.java 72.72% <0.00%> (-7.28%) ⬇️
.../spi/transfer/observe/TransferProcessListener.java 0.00% <ø> (ø)
...act/listener/ContractNegotiationEventListener.java 8.69% <8.69%> (ø)
...ceconnector/contract/ContractServiceExtension.java 95.71% <100.00%> (+0.06%) ⬆️
...egotiation/AbstractContractNegotiationManager.java 94.18% <100.00%> (+0.06%) ⬆️
...iation/ConsumerContractNegotiationManagerImpl.java 87.38% <100.00%> (+0.42%) ⬆️
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93f4b0c...4086613. Read the comment docs.

@paullatzelsperger
Copy link
Member

... the pre- action methods are used by some implementors, as we discussed a lot about this especially with @algattik and @ouphi .

There are none I could find in the EDC code base, but maybe there are some downstream. I'll have a look.

@ndr-brt ndr-brt requested a review from paullatzelsperger July 8, 2022 13:33
@paullatzelsperger
Copy link
Member

@paullatzelsperger I think the pre- action methods are used by some implementors, as we discussed a lot about this especially with @algattik and @ouphi . I would suggest to remove this pre- methods once the event system will get the persistence in a transactional context with the state change, doing that we're sure that every state change will have its own event (without the risk of losing them), this will enable audit on them. Just some ideas dropped here, we'd need to discuss if this is really needed and how it should be done.

@ndr-brt I looked at the code base of EDC, MVD and RegistrationService, found no usage the pre- methods of ContractNegotiationListener. I think we're good removing them. Is it possible you meant the pre- methods on the TransferProcessListener? There are indeed usages/implementations of those...

@ndr-brt
Copy link
Member Author

ndr-brt commented Jul 11, 2022

@paullatzelsperger I think the pre- action methods are used by some implementors, as we discussed a lot about this especially with @algattik and @ouphi . I would suggest to remove this pre- methods once the event system will get the persistence in a transactional context with the state change, doing that we're sure that every state change will have its own event (without the risk of losing them), this will enable audit on them. Just some ideas dropped here, we'd need to discuss if this is really needed and how it should be done.

@ndr-brt I looked at the code base of EDC, MVD and RegistrationService, found no usage the pre- methods of ContractNegotiationListener. I think we're good removing them. Is it possible you meant the pre- methods on the TransferProcessListener? There are indeed usages/implementations of those...

Probably yes, I guess if there's the need for them in TransferProcess they could be needed on ContractNegotiation too.
Anyway will create an issue to remove them from the ContractNegotiationListener

@ndr-brt ndr-brt merged commit 54578a3 into eclipse-edc:main Jul 11, 2022
@ndr-brt ndr-brt deleted the feature/1439-dispatch-contractnegotiation-events branch July 11, 2022 11:59
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.

Event Framework: dispatch ContractNegotiation events
4 participants