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

Is it intended that if a Subscription does not exist a ServiceBusCommunicationEx is thrown instead of a MessagingEntityNotFoundEx? #6943

Closed
TheReaLee opened this issue Jul 16, 2019 · 8 comments · Fixed by #7942
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention Workflow: This issue is responsible by Azure service team. Service Bus
Milestone

Comments

@TheReaLee
Copy link

TheReaLee commented Jul 16, 2019

Query/Question
Is it intended that if a Subscription does not exist a ServiceBusCommunicationEx is thrown rather than a MessagingEntityNotFoundException?

Why is this not a Bug or a feature Request?
Our team is currently building a wrapper around the Microsoft.Azure.ServiceBus project and have noticed that when a Topic or Queue does not exist a MessagingEntityNotFoundException is thrown whereas when a Subscription does not exists a ServiceBusCommunicationException is thrown.

Is this intended and if yes why so?... Doesn't a Topic + Subscription make up a Messaging Entity?

Setup

  • OS: Windows 10 version 1809
  • IDE : Visual Studio Enterprise 2019
  • Version of the Library used: 3.4.0
protected override void SubscribeInternal()
{
	RetryExponential retryExponential = new RetryExponential(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), 3);

	string topicName = "TestTopic";
	//This subscription has not been created
	string subscriptionName = "Sub1";

        _azureSubscriptionClient = new SubscriptionClient(this._getConnectionString(), topicName, subscriptionName, ReceiveMode.PeekLock, retryExponential);
	MessageHandlerOptions messageHandlerOptions = new MessageHandlerOptions(_onExceptionThrownHandler)
	{                   
	    MaxConcurrentCalls = _topicSubscriptionConnectionOptions.MaxConcurrentMessages,                   
	    AutoComplete = false
	};
	_azureSubscriptionClient.RegisterMessageHandler(_onMessageReceivedHandler, messageHandlerOptions);
}

private Task _onExceptionThrownHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
{
    Exception exception = exceptionReceivedEventArgs.Exception;
    //exception.GetType() == 'ServiceBusCommunicationException'
    ...
}

private async Task _onMessageReceivedHandler(Message message, CancellationToken token)
{
    ...
}
@triage-new-issues triage-new-issues bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jul 16, 2019
@TheReaLee TheReaLee changed the title Is it intended that if a Subscription does not exist a ServiceBusCommunicationEx is thrown rather than a MessagingEntityNotFoundException? Is it intended that if a Subscription does not exist a ServiceBusCommunicationEx is thrown instead of a MessagingEntityNotFoundEx? Jul 16, 2019
@kurtzeborn kurtzeborn added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Bus and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Jul 16, 2019
@kurtzeborn
Copy link
Member

Thanks for opening this issue. I've attempted to route this to the appropriate team who should be able to get you an answer on what's going on here.

@TheReaLee
Copy link
Author

@kurtzeborn any news about this?

@jsquire jsquire added the Service Attention Workflow: This issue is responsible by Azure service team. label Sep 5, 2019
@jsquire
Copy link
Member

jsquire commented Sep 5, 2019

@nemakam, @binzywu : Would one of you be so kind as to offer your thoughts?

@SeanFeldman
Copy link
Contributor

I think the issue is more general. It's not just about subscriptions. It's about any entity. Currently, MessagingEntityNotFoundException is only thrown on NamespaceManager operations, but not MessageSender/MessageReceiver. I can send a PR.

@SeanFeldman
Copy link
Contributor

SeanFeldman commented Sep 10, 2019

I've run through a scenario where a connection is established, the subscription is removed, and an operation to send/receive a message is attempted. The issue is that AmqpLinkCreator.CreateAndOpenAmqpLinkAsync() will throw. When it does, it will convert the exception using AmqpExceptionHelper.GetClientException(connectionError), where connectionError is a boolean determined by session.IsClosing(). This will always be true given that a line above session.SafeClose(exception); is called. As a result of that AmqpExceptionHelper.ToMessagingContractException() will return ServiceBusCommunicationException rather than MessagingEntityNotFoundException.

Also, AmqpExceptionHelper.GetClientException() should handle a case with MessagingEntityNotFoundException and return aggregateException as-is.

@nemakam does this sound right to you?

@SeanFeldman
Copy link
Contributor

BTW, a simpler way to repro this would be:

var receiver = new MessageReceiver(connectionString, "topic/sub"); // let `topic` exist, but not `sub`
await receiver.ReceiveAsync();

@axisc axisc added this to the Sprint 164 milestone Sep 27, 2019
@axisc
Copy link

axisc commented Sep 27, 2019

@TheReaLee - thanks for raising this.

I think this is definitely a MessagingEntityNotFoundException.
Adding it to the backlog and assigning the January milestone to it.

nemakam added a commit that referenced this issue Oct 12, 2019
…ndException (#7942)

Ensure opening link to non-existing subscription throws MessagingEntityNotFoundException

Fixes #6943
@ghost
Copy link

ghost commented Oct 12, 2019

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention Workflow: This issue is responsible by Azure service team. Service Bus
Projects
None yet
7 participants