It is expected to throw a ServiceException. We actually have a unit test to validate this behavior, please see getNonExistQueueFail() in the following file.
Can perform getQueue() for nonexistent Azure SerivceBus Queue using JAVA sdk
-
29-03-2022 - |
Question
In the last 26 or so hours calls to ServiceBusConstract.getQueue(path) where path is a non-existent queue are throwing a ServiceException whose ultimate cause is a binding issue.
Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2005/Atom", local:"feed"). Expected elements are <{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}QueueDescription>,<{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}SubscriptionDescription>,<{http://schemas.microsoft.com/netservices/2010/10/servicebus/connect}TopicDescription>,<{http://www.w3.org/2005/Atom}entry> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:647)
This is true when using both 0.4.0 and 0.4.1 versions of the SDK.
Previously,this call returned a GetQueueResult whose .getValue() method returned null. Found this as my tests are now failing.
Have the production services been updates to no longer be compatible with this call? What is the expected behavior of ServiceBusContract.getQueue(nonExistentPath)?
Solution