Skip to content

[Service Bus] Move settlement & renewLock methods from message to receiver#11962

Merged
ramya-rao-a merged 9 commits into
Azure:masterfrom
ramya-rao-a:settlement
Oct 22, 2020
Merged

[Service Bus] Move settlement & renewLock methods from message to receiver#11962
ramya-rao-a merged 9 commits into
Azure:masterfrom
ramya-rao-a:settlement

Conversation

@ramya-rao-a
Copy link
Copy Markdown
Contributor

@ramya-rao-a ramya-rao-a commented Oct 21, 2020

This PR moves the settlement and renewLock methods from the message to the receiver as per #11926 with minimal changes to the code. Things to clean up in a following PR post GA

  • Move the actual implementation from message to receiver. Right now, the methods on the receiver simply call the corresponding methods on the message
  • After the above move and the work in [Service Bus] Track data transformer in sender/receiver instead of connection context #10620, the message will no longer need to keep track of the connection context and so can be removed making the message just the representation of the amqp message underneath and nothing else.

I have retained the overloads for createReceiver and createSessionReceiver methods even though there is no difference between the overloads anymore. This is to facilitate the next step of ensuring that users in ReceiveAndDelete mode do not see the settlement methods or the renewMessageLock method. There are two approaches to this which are experimented with in

@Azure Azure deleted a comment from azure-pipelines Bot Oct 21, 2020
@ramya-rao-a ramya-rao-a changed the title [Service Bus] Move settlement methods to receiver [Service Bus] Move settlement & renewLock methods from message to receiver Oct 21, 2020
@ramya-rao-a
Copy link
Copy Markdown
Contributor Author

@Azure Azure deleted a comment from azure-pipelines Bot Oct 21, 2020
@Azure Azure deleted a comment from azure-pipelines Bot Oct 21, 2020
createReceiver(queueName: string, options: CreateReceiverOptions<"receiveAndDelete">): ServiceBusReceiver<ServiceBusReceivedMessage>;
createReceiver(topicName: string, subscriptionName: string, options?: CreateReceiverOptions<"peekLock">): ServiceBusReceiver<ServiceBusReceivedMessageWithLock>;
createReceiver(topicName: string, subscriptionName: string, options: CreateReceiverOptions<"receiveAndDelete">): ServiceBusReceiver<ServiceBusReceivedMessage>;
createReceiver(queueName: string, options?: CreateReceiverOptions<"peekLock">): ServiceBusReceiver;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we aren't returning different types, there is no point in using the generics.
It could just be CreateReceiverOptions with an attribute "receiveMode".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same for acceptSession and any other generics involving receiveMode

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please see the note in the PR description on this topic

I have retained the overloads for createReceiver and createSessionReceiver methods even though there is no difference between the overloads anymore. This is to facilitate the next step of ensuring that users in ReceiveAndDelete mode do not see the settlement methods or the renewMessageLock method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

Comment thread sdk/servicebus/service-bus/src/receivers/receiver.ts Outdated
Comment thread sdk/servicebus/service-bus/src/receivers/receiver.ts Outdated
Comment thread sdk/servicebus/service-bus/test/backupMessageSettlement.spec.ts Outdated
Comment thread sdk/servicebus/service-bus/test/receiveAndDeleteMode.spec.ts Outdated
Comment thread sdk/servicebus/service-bus/test/receiveAndDeleteMode.spec.ts Outdated
Comment thread sdk/servicebus/service-bus/test/receiveAndDeleteMode.spec.ts Outdated
Copy link
Copy Markdown
Member

@richardpark-msft richardpark-msft left a comment

Choose a reason for hiding this comment

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

It all looks pretty much how you'd expect, thanks for doing this.

What happened with backupMessageSettlement.spec.ts though?

Comment thread sdk/servicebus/service-bus/test/receiveAndDeleteMode.spec.ts Outdated
@ramya-rao-a
Copy link
Copy Markdown
Contributor Author

What happened with backupMessageSettlement.spec.ts though?

The tests here closed the user facing receiver and then tried to settle messages. This is no longer a flow we would be expecting people to use. Rather, the tests need to close the underlying AMQP receiver link. I am doing this in 52b585f. The session related tests are failing which needs to be followed up. I dont mind removing them altogether as we dont have back up message settlement plan for sessions

await msgBatch[0].complete();
await receiver.completeMessage(msgBatch[0]);
} else {
should.equal(errorWasThrown, false, "Error was thrown for sessions without session-id");
Copy link
Copy Markdown
Contributor

@HarshaNalluru HarshaNalluru Oct 22, 2020

Choose a reason for hiding this comment

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

I think I meant ...thrown for messages without session-id"

await beforeEachTest(withSessionTestClientType);
await testComplete();
});
// it(withSessionTestClientType + ": complete() removes message", async function(): Promise<void> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not uncomment these session tests?
It'll ensure that we are indeed providing a decent error message in the case of sessions IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As mentioned #11962 (comment), these tests are failing and would need follow up.

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