Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/storage/azure-storage-queue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 12.7.0-beta.2 (Unreleased)
- Added support to specify whether or not a pipeline policy should be added per call or per retry.
- Fixed a bug that would cause a NPE when visibilityTimeout was set to null in QueueClient.updateMessage

## 12.7.0-beta.1 (2020-10-01)
- Added support for the 2020-02-10 service version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ PagedFlux<PeekedMessageItem> peekMessagesWithOptionalTimeout(Integer maxMessages
* @param popReceipt Unique identifier that must match for the message to be updated
* @param messageText Updated value for the message
* @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The
* timeout period must be between 1 second and 7 days.
* timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.
* @return A {@link UpdateMessageResult} that contains the new
* {@link UpdateMessageResult#getPopReceipt() popReceipt} to interact with the message,
* additionally contains the updated metadata about the message.
Expand Down Expand Up @@ -812,7 +812,7 @@ public Mono<UpdateMessageResult> updateMessage(String messageId, String popRecei
* @param popReceipt Unique identifier that must match for the message to be updated
* @param messageText Updated value for the message
* @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The
* timeout period must be between 1 second and 7 days.
* timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.
* @return A {@link UpdateMessageResult} that contains the new
* {@link UpdateMessageResult#getPopReceipt() popReceipt} to interact with the message,
* additionally contains the updated metadata about the message.
Expand All @@ -833,6 +833,7 @@ Mono<Response<UpdateMessageResult>> updateMessageWithResponse(String messageId,
String messageText, Duration visibilityTimeout, Context context) {
QueueMessage message = messageText == null ? null : new QueueMessage().setMessageText(messageText);
context = context == null ? Context.NONE : context;
visibilityTimeout = visibilityTimeout == null ? Duration.ZERO : visibilityTimeout;
return client.messageIds().updateWithRestResponseAsync(queueName, messageId, popReceipt,
(int) visibilityTimeout.getSeconds(), message, null, null,
context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public PagedIterable<PeekedMessageItem> peekMessages(Integer maxMessages, Durati
* @param popReceipt Unique identifier that must match for the message to be updated
* @param messageText Updated value for the message
* @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The
* timeout period must be between 1 second and 7 days.
* timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.
* @return A {@link UpdateMessageResult} that contains the new
* {@link UpdateMessageResult#getPopReceipt() popReceipt} to interact with the message,
* additionally contains the updated metadata about the message.
Expand Down Expand Up @@ -612,7 +612,7 @@ public UpdateMessageResult updateMessage(String messageId, String popReceipt, St
* @param popReceipt Unique identifier that must match for the message to be updated
* @param messageText Updated value for the message
* @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The
* timeout period must be between 1 second and 7 days.
* timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.
* @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout
* concludes a {@link RuntimeException} will be thrown.
* @param context Additional context that is passed through the Http pipeline during the service call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,23 @@ class QueueAPITests extends APISpec {
messageText == peekMsgIter.getMessageText()
}

def "Update message null duration"() {
given:
def messageText = "test message before update"
queueClient.create()
queueClient.sendMessage(messageText)

def dequeueMsg = queueClient.receiveMessage()
when:
def updateMsgResponse = queueClient.updateMessageWithResponse(dequeueMsg.getMessageId(),
dequeueMsg.getPopReceipt(), null, null, null, null)
sleepIfLive(2000)
def peekMsgIter = queueClient.peekMessage()
then:
QueueTestHelper.assertResponseStatusCode(updateMsgResponse, 204)
messageText == peekMsgIter.getMessageText()
}

@Unroll
def "Update message invalid args"() {
given:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
"Uri" : "https://REDACTED.queue.core.windows.net/queueapitestsupdatemessagenullduration842819d7fed86",
"Headers" : {
"x-ms-version" : "2020-02-10",
"User-Agent" : "azsdk-java-azure-storage-queue/12.7.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "f9843273-eb84-46fd-b7f4-cd6f3285bf82"
},
"Response" : {
"x-ms-version" : "2020-02-10",
"Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
"x-ms-request-id" : "3bf16729-a003-0028-49f4-a74401000000",
"Date" : "Wed, 21 Oct 2020 21:49:25 GMT",
"x-ms-client-request-id" : "f9843273-eb84-46fd-b7f4-cd6f3285bf82"
},
"Exception" : null
}, {
"Method" : "POST",
"Uri" : "https://REDACTED.queue.core.windows.net/queueapitestsupdatemessagenullduration842819d7fed86/messages",
"Headers" : {
"x-ms-version" : "2020-02-10",
"User-Agent" : "azsdk-java-azure-storage-queue/12.7.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "ea0d98d0-caba-4aa1-9e0a-ae8283e82051",
"Content-Type" : "application/xml; charset=utf-8"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2020-02-10",
"Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-id" : "3bf16759-a003-0028-72f4-a74401000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><QueueMessagesList><QueueMessage><MessageId>f28a8611-c393-4825-92fa-e48e661b59c8</MessageId><InsertionTime>Wed, 21 Oct 2020 21:49:27 GMT</InsertionTime><ExpirationTime>Wed, 28 Oct 2020 21:49:27 GMT</ExpirationTime><PopReceipt>AgAAAAMAAAAAAAAAqrNhDPSn1gE=</PopReceipt><TimeNextVisible>Wed, 21 Oct 2020 21:49:27 GMT</TimeNextVisible></QueueMessage></QueueMessagesList>",
"Date" : "Wed, 21 Oct 2020 21:49:26 GMT",
"x-ms-client-request-id" : "ea0d98d0-caba-4aa1-9e0a-ae8283e82051",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
"Uri" : "https://REDACTED.queue.core.windows.net/queueapitestsupdatemessagenullduration842819d7fed86/messages?numofmessages=1",
"Headers" : {
"x-ms-version" : "2020-02-10",
"User-Agent" : "azsdk-java-azure-storage-queue/12.7.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "b00cfa4e-e113-439e-b457-b3e44193dd5b"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2020-02-10",
"Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0",
"Cache-Control" : "no-cache",
"retry-after" : "0",
"StatusCode" : "200",
"x-ms-request-id" : "3bf1676c-a003-0028-04f4-a74401000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><QueueMessagesList><QueueMessage><MessageId>f28a8611-c393-4825-92fa-e48e661b59c8</MessageId><InsertionTime>Wed, 21 Oct 2020 21:49:27 GMT</InsertionTime><ExpirationTime>Wed, 28 Oct 2020 21:49:27 GMT</ExpirationTime><PopReceipt>AgAAAAMAAAAAAAAACf1qHvSn1gE=</PopReceipt><TimeNextVisible>Wed, 21 Oct 2020 21:49:57 GMT</TimeNextVisible><DequeueCount>1</DequeueCount><MessageText>test message before update</MessageText></QueueMessage></QueueMessagesList>",
"Date" : "Wed, 21 Oct 2020 21:49:26 GMT",
"x-ms-client-request-id" : "b00cfa4e-e113-439e-b457-b3e44193dd5b",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "PUT",
"Uri" : "https://REDACTED.queue.core.windows.net/queueapitestsupdatemessagenullduration842819d7fed86/messages/f28a8611-c393-4825-92fa-e48e661b59c8?popreceipt=AgAAAAMAAAAAAAAACf1qHvSn1gE%3D&visibilitytimeout=0",
"Headers" : {
"x-ms-version" : "2020-02-10",
"User-Agent" : "azsdk-java-azure-storage-queue/12.7.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "e961f723-85ca-4369-99b0-34b4aebf9a6c"
},
"Response" : {
"x-ms-version" : "2020-02-10",
"Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0",
"x-ms-time-next-visible" : "Wed, 21 Oct 2020 21:49:28 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "204",
"x-ms-request-id" : "3bf16782-a003-0028-18f4-a74401000000",
"x-ms-popreceipt" : "AwAAAAMAAAAAAAAA+IunDPSn1gEBAAAA",
"Date" : "Wed, 21 Oct 2020 21:49:27 GMT",
"x-ms-client-request-id" : "e961f723-85ca-4369-99b0-34b4aebf9a6c"
},
"Exception" : null
}, {
"Method" : "GET",
"Uri" : "https://REDACTED.queue.core.windows.net/queueapitestsupdatemessagenullduration842819d7fed86/messages?peekonly=true",
"Headers" : {
"x-ms-version" : "2020-02-10",
"User-Agent" : "azsdk-java-azure-storage-queue/12.7.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "7abaf01c-93d1-4d12-93ed-61932a1ed0de"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2020-02-10",
"Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0",
"Cache-Control" : "no-cache",
"retry-after" : "0",
"StatusCode" : "200",
"x-ms-request-id" : "3bf167d5-a003-0028-66f4-a74401000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><QueueMessagesList><QueueMessage><MessageId>f28a8611-c393-4825-92fa-e48e661b59c8</MessageId><InsertionTime>Wed, 21 Oct 2020 21:49:27 GMT</InsertionTime><ExpirationTime>Wed, 28 Oct 2020 21:49:27 GMT</ExpirationTime><DequeueCount>1</DequeueCount><MessageText>test message before update</MessageText></QueueMessage></QueueMessagesList>",
"Date" : "Wed, 21 Oct 2020 21:49:29 GMT",
"x-ms-client-request-id" : "7abaf01c-93d1-4d12-93ed-61932a1ed0de",
"Content-Type" : "application/xml"
},
"Exception" : null
} ],
"variables" : [ "queueapitestsupdatemessagenullduration842819d7fed86" ]
}