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

[service-bus] init() refactor to propagate abortSignal support. #10578

Conversation

richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Aug 12, 2020

As part of the abortSignal work we found out there are quite a few duplicated code paths. One of the bigger ones was around init(), which is in 4 spots (ManagementClient, Receiver, Sender and MessageSession).

The changes in this PR:

  • Unifies the common part of the init() inside of LinkEntity under initLink()
  • Makes some fields and methods private that used to be protected or public - this preps a possible containment strategy with LinkEntity in the future. This was mostly the result of just moving the connection related logic into LinkEntity from the child classes.
  • Exposes the abortSignal as a field in the session receiver options and enables aborting the creation of a session receiver.
  • Cleans up the unit tests a bit, adding in proper support for setting up the token renewal timer (through a bug in the tests it was just early existing before).

This adds session initialization abortSignal support for #4375

This PR unites all the managment links so they use the same code to
open and close the underlying link. As part of this a few nice
refactors were able to happen:

1. All link related classes, including the mgmt link, now use the same
init() code (which also means they can, if passed, handle abortSignal's
when running)
2. open/close state has been moved into LinkEntity.
3. Boundaries between LinkEntity and the child classes is more clear.
@ghost ghost added the Service Bus label Aug 12, 2020
@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…loseInitiated only reflected the user calling .close()).

* Adding in unit tests for LinkEntity
…rying to add credits when the receiver is closed).

Should help catch bugs.
- change the close originator to a close mode and now it's "permanently" or "linkonly".
- Rename the _'d elements to make them normal methods but then marked them as protected. This works fine since the classes aren't actually used in the public API.
… Not a big deal but no reason to do it either.
…now rather than wait for the .close() call to complete.
…eted (no longer used by child classes).

* Remove the last calls that were still in the management client (they're all taken care of by LinkEntity.initLink() now)
…h is causing a timer to be created (and this requires us to properly close the clients we create).
… the link object it while we were initializing. If so it throws an error.
@richardpark-msft richardpark-msft changed the title [WIP] init() refactor to propagate abortSignal support. [service-bus] init() refactor to propagate abortSignal support. Aug 13, 2020
@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@richardpark-msft richardpark-msft marked this pull request as ready for review August 13, 2020 01:00
@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

… specify the same partition key as session id.
@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…zed (they both check it). So we can get rid of the outer check.
…_isOpen()

* Remove some redundant isOpen() calls (for instance, in closeLink)
* Remove redundant call to clear the token renewal timer in the management link in favor of the one that's already occuring in LinkEntity. That was the last non-linkEntity usage so I was able to make the timer private.
…ving a comment inline to explain why mgmt client is different.
…accessor)

- Use wasClosedPermanently in the Sender.
@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@richardpark-msft
Copy link
Member Author

/azp run js - servicebus - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@richardpark-msft
Copy link
Member Author

I'll need to take a better look at those failures.

@richardpark-msft richardpark-msft merged commit 6630763 into Azure:master Aug 18, 2020
@richardpark-msft richardpark-msft deleted the richardpark-sb-track2-refactor-streamingreceiver-2-lite branch August 18, 2020 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants