azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

Service Bus Timeout Messages

Open joostdenijs opened this issue 14 years ago • 4 comments

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.

joostdenijs avatar Jul 16 '12 21:07 joostdenijs

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.

BillAtPros avatar Mar 25 '13 15:03 BillAtPros

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

gcheng avatar Mar 25 '13 17:03 gcheng

Note that BillAtPros and WillD are the same person :)

BillAtPros avatar Mar 25 '13 18:03 BillAtPros

close due to duplication

https://github.com/WindowsAzure/azure-sdk-for-java/issues/301

gcheng avatar Apr 11 '13 00:04 gcheng