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

Make the session adapter class public #6526

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

timbussmann
Copy link
Contributor

As discussed on yesterday's sync, this is a quick attempt of making the adapter class public instead of directly implementing and wrapping CompleteableSynchronizedStorageSession to reduce potential confusion about the specific implementation of the interface.

@danielmarbach
Copy link
Contributor

danielmarbach commented Sep 1, 2022

I still prefer the current version I must say because it ressembles very closely to the v8 version except the usage of the GetAdaptedSession extension method. Everything else is exactly the same as the v8 version and I like that

But I agree the adapter implementing also the Completable interface could be a bit confusing

In case other's prefer this variant I won't hold things up though

Copy link
Contributor

@danielmarbach danielmarbach left a comment

Choose a reason for hiding this comment

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

Approving even though I prefer the current version

@timbussmann
Copy link
Contributor Author

under the assumption that this has no/little impact on the downstream usage (TxSession), I think I prefer this approach as it the safer approach and avoids any potential confusion due to the casting that happens in code and the persistence-specific extension methods. I think the downside of this approach is slightly different from v8 is acceptable, the API usage matches the v8 version, it's just a different type being used.

This PR is currently missing the obsolete markers on he adapter class though.

@danielmarbach
Copy link
Contributor

How about

[ObsoleteEx(Message = "CompletableSynchronizedStorageSessionAdapter is intended as an interim solution for 7.x versions of Core and is already replaced on the next major version by CompletableSynchronizedStorageSession.", TreatAsErrorFromVersion = "8.0", RemoveInVersion = "9.0")]

but then if we do that we technically also need to add the obsoleted class to the v8 obsoletes... I wonder if this is really necessary for such an internal change

@timbussmann
Copy link
Contributor Author

but then if we do that we technically also need to add the obsoleted class to the v8 obsoletes... I wonder if this is really necessary for such an internal change

I think it would be ok to just remove the class with v8?

@danielmarbach
Copy link
Contributor

Agreed

/// </summary>
/// <param name="session">The storage session.</param>
public static CompletableSynchronizedStorageSession GetAdaptedSession(this CompletableSynchronizedStorageSession session) =>
((CompletableSynchronizedStorageSessionAdapter)session).AdaptedSession;
Copy link
Contributor

Choose a reason for hiding this comment

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

@timbussmann We discussed this during this morning's sync. I agree this looks very confusing, but keeping v7 and v8 aligned should be a priority, especially due to how we work and how much context is lost around these changes.

Would it be helpful if we modify this as proposed in #6529 ?

@danielmarbach danielmarbach marked this pull request as ready for review September 6, 2022 09:46
@danielmarbach
Copy link
Contributor

Discussed this again and indeed this approach is superior because it avoids the scenario of being able to inject. I did double check the ReceiveComponent registration and we are no longer providing a binding of CompletableSynchronizedStorageSession. You always have to resolve the adapter so that is good. Going to merge

@danielmarbach
Copy link
Contributor

I'm assuming we are still ok with just removing the class in v8 since it is such an internal concept

@danielmarbach danielmarbach merged commit 17e6c49 into storage-session-improvements Sep 6, 2022
@danielmarbach danielmarbach deleted the public-adapter branch September 6, 2022 09:56
danielmarbach added a commit that referenced this pull request Sep 9, 2022
* Introduce SynchronizedStorage feature
Bring in feature dependency
Approve API

* Adapter to bridge the old and the new world

* Make it possible to retrieve the storage session via DI and also open the completable one from outside the core

* Add acceptance test that verifies session can be opened outside the pipeline

* Additional checks

* Shorter endpoint name

* Reregister the CompletableSynchronizedStorageSession properly so that we don't override

Co-authored-by: Tomasz Masternak <tomasz.masternak@particular.net>

* Fix synchronized storage retrival

* Update src/NServiceBus.Core/Pipeline/Incoming/LoadHandlersConnector.cs

Co-authored-by: Tim Bussmann <timbussmann@users.noreply.github.com>

* make GetAdaptedSession extension public

* Session disposal (#6525)

* resolve storage session per call

* only dispose session once

* approve scope change in test

* change registration back to same scope as the referenced type

* Use GetAdaptedSession consistently

* Make the session adapter class public (#6526)

* make the session adapter class public

* Approve

Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net>

* Move CompletableSynchronizedStorageSessionAdapter into the persistence namespace

* Rename paramater

* aligning names

Co-authored-by: Tomasz Masternak <tomasz.masternak@particular.net>
Co-authored-by: Tim Bussmann <timbussmann@users.noreply.github.com>
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.

3 participants