Service Bus Timeout Messages
Moved from private repo.
For Messages that timeout, we currently have it return an uninitialized message, instead we need it to throw a 204 ServiceException in accordance with the servicebus team documentation.
Actually, a 200 series Status code (in this case 204) is not considered Exceptional or an Error. An empty queue is not an error condition, but a viable status. Instead of throwing a ServiceException, simply set the ReceiveQueueMessageResult's value to null. This is consistent with Java's general pattern of returning null when there is no relevant data for a given operation. Compare with java.util.Map.get(Object key). Obviously an uninitialized BrokeredMesage is not the same as a null one. Differentiating an empty Message from an empty Queue seems a key distinction.
All that said, exposing the status code and message for inspection in the RQMR might not be valuable in addition.
Have already forked the project. A couple of comments about a solution. 1) A call to an empty queue, should not, IMO, cause a ServiceException. 200 series status codes indicates a successful/correct invocation. The 204 code returned indicates the queue was empty, this is not an Exceptional or Error condition. 2) The current implementation returns an empty BrokeredMessage. A content-length of 0 should not indicate that the Queue is empty. It's common practice in messaging systems to create valid messages that have no body, but convey their intent via headers/properties. – WillD 2 hours ago
Note that BillAtPros and WillD are the same person :)
close due to duplication
https://github.com/WindowsAzure/azure-sdk-for-java/issues/301