-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ServiceBus] add state
property to ServiceBusReceivedMessage
#18938
Conversation
API changes have been detected in API changes + readonly messageState: "x-opt-message-state"; |
API changes have been detected in API changes + export declare enum ServiceBusMessageState
+ readonly state?: ServiceBusMessageState; |
@@ -2,7 +2,7 @@ | |||
"name": "@azure/service-bus", | |||
"sdk-type": "client", | |||
"author": "Microsoft Corporation", | |||
"version": "7.4.1", | |||
"version": "7.5.0", |
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.
do we normally release a beta first?
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.
Since we havent discussed this with other languages yet, I would be ok with a beta. Otherwise, it is a straight forward feature that we could have gone GA directly with
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.
Changed to 7.5.0-beta.1 for now.
… enum A message's state is active if it is neither deferred nor scheduled.
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
API changes have been detected in API changes + readonly state: "active" | "deferred" | "scheduled"; |
sdk/core/core-amqp/CHANGELOG.md
Outdated
@@ -7,6 +7,7 @@ | |||
- Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features | |||
- With the dropping of support for Node.js versions that are no longer in LTS, the dependency on `@types/node` has been updated to version 12. Read our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. | |||
- Updated to use the latest version of the `rhea` package. | |||
- Add a constant `messageState` with value of `"x-opt-message-state"`. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) |
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.
- Add a constant `messageState` with value of `"x-opt-message-state"`. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) | |
- Add a constant `messageState` with value of `"x-opt-message-state"` to be used as property name for the new state property on the message. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) |
|
||
### Features Added | ||
|
||
- Add `state` property `ServiceBusReceivedMessage`. Its value is one of `"active"`, `"deferred"`, or `"scheduled"`. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) |
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.
- Add `state` property `ServiceBusReceivedMessage`. Its value is one of `"active"`, `"deferred"`, or `"scheduled"`. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) | |
- Add `state` property to `ServiceBusReceivedMessage`. Its value is one of `"active"`, `"deferred"`, or `"scheduled"`. [PR 18938](https://github.com/Azure/azure-sdk-for-js/pull/18938) |
if (rheaMessage.message_annotations != null) { | ||
if (rheaMessage.message_annotations[Constants.deadLetterSource] != null) { | ||
props.deadLetterSource = rheaMessage.message_annotations[Constants.deadLetterSource]; | ||
} | ||
const messageState = rheaMessage.message_annotations[Constants.messageState]; | ||
if (isDefined(messageState) && (messageState === 1 || messageState === 2)) { |
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.
Do we need the isDefined
check here? Won't the below just work without the defined check?
if (messageState === 1) {
props.state = "deferred";
} else if (messageState === 2) {
props.state = "scheduled";
}
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.
Yeah this is enough. IsDefined() is from previous iteration that no longer needed.
@@ -905,6 +923,7 @@ export class ServiceBusMessageImpl implements ServiceBusReceivedMessage { | |||
this._rawAmqpMessage = _rawAmqpMessage; | |||
this._rawAmqpMessage.bodyType = actualBodyType; | |||
this.delivery = delivery; | |||
this.state = restOfMessageProps.state; |
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.
Doesnt the Object.assign(this, restOfMessageProps);
at line 902 take care of assigning the state?
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.
TypeScript compiler is not smart enough to detect that. I added some comments.
Looks like the build is failing due to a missing rush update |
@@ -1132,6 +1132,29 @@ packages: | |||
- supports-color | |||
dev: false | |||
|
|||
/@azure/service-bus/7.4.0: |
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.
which part of our repo depend on this version?
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.
eventgrid and perf-service-bus depends on ^7.0.0
.
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 see. It may not be worth it to make perf-service-bus depend on this beta but perhaps something to consider.
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 looked at history and we haven't done that for older versions. Though we probably want perf tests to always use source version @HarshaNalluru?
It can be one of the three
ServiceBusMessageState
values:"active"
,"deferred"
, or"scheduled"
.Several tests are updated to verify the message state property.