-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Pass associatedLinkName to updateDispositionStatus() API #2787
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f7899cd
Pass associatedLinkName to updateDispositionStatus() API
24d2e52
Combine if-else
dd71f9b
Use private helper
442bc79
Move helper to util and update 7 other usages
054ddc6
Address comments
44ee9a3
Merge branch 'master' into issue-2611-v2
ramya0820 355fb6d
Merge branch 'master' into issue-2611-v2
ramya0820 558fbcc
Merge branch 'master' into issue-2611-v2
ramya0820 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not guaranteed that
this._context.messageSessions[this.sessionId]would exist. ThemessageSessionfor the session could have been closed in which casethis_context.messageSessionsmap will not have an entry forthis.sessionId.Also, we are repeating this logic of finding the associated link name in 4 places. Can we create a private helper method, say
getAssociatedLinkName()instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make such a helper method, then we can use it in all other places, where we do similar if/else checks to get the associated link name. Here is my proposal, let me know what you think
clientEntityContext.ts(or other file as you see fit)getAssociatedReceiverLinkName(clientContext: ClientEntityContext, sessionId?: string)getAssociatedSenderLinkName(clientContext: ClientEntityContext)ManagementClientclass that need theassociatedLinkNamecan call one of the above instead of expecting the caller to pass in the value.Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the sessionId not being present when it's expired, in such cases there is no associated link name to pass. Hence, the implementations holds good.
About refactoring to use these 2 additions on the interface, I think it would need a design discussion and further efforts. For this PR, we can unblock ourselves with current changes and take it up later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to the error we would get when trying to get the
namei.efor the session expired scenario, in the below code, we will get "
namedoesnt exist onundefined" error sincethis._context.messageSessions[this.sessionId]will returnundefinedThe helper functions need not be on the interface of ClientEntityContext. The way I have suggested above, they can be stand-alone helper functions and not inside any interface or class.
At present we have the
_getAssociatedReceiverName()as part of this PR to reduce code duplication in 4 places. With slight modification (takecontextandsessionIdas input parameters instead of using fromthis), the same helper can be used from 7 other places (3 inReceiver, 2 inQueueClientand 2 inSubscriptionClient). We should atleast pick this up for this PR.Updating the functions in the
ManagementClientclass to use this helper (and another for sender) instead of takingassociatedLinkNamecan be taken up later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay, updating to include the undefined check on
messageSessions.Adding the helper function to utils.ts and updating the receiver related references
(Adding it to ClientEntityContext seemed confusing/difficult at first since this was bookkeeping a lot of things.)