diff --git a/src/AWSSQS.jl b/src/AWSSQS.jl index aa25731..a50f686 100644 --- a/src/AWSSQS.jl +++ b/src/AWSSQS.jl @@ -194,7 +194,7 @@ end """ sqs_receive_message(::AWSQueue) -Returns a `Dict` containing `:message` and `:handle` +Returns a `Dict` containing `:message`, `:id` and `:handle` or `nothing` if the queue is empty. ``` @@ -212,11 +212,12 @@ function sqs_receive_message(queue::AWSQueue) end handle = r[1]["ReceiptHandle"] + id = r[1]["MessageId"] message = r[1]["Body"] md5 = r[1]["MD5OfBody"] @assert md5 == bytes2hex(digest(MD_MD5, message)) - @SymDict(message, handle) + @SymDict(message, id, handle) end diff --git a/test/queue.jl b/test/queue.jl index 968e4e6..2a17670 100644 --- a/test/queue.jl +++ b/test/queue.jl @@ -25,6 +25,7 @@ end sqs_send_message(queue, "Hello!", options...) message = sqs_receive_message(queue) + @test haskey(message, :id) && !isempty(message[:id]) @test message[:message] == "Hello!" end @@ -52,6 +53,7 @@ end sqs_send_message(queue, "Hello!") message = sqs_receive_message(queue) + @test haskey(message, :id) && !isempty(message[:id]) @test message[:message] == "Hello!" end @@ -66,6 +68,7 @@ end @test message_count == num_messages while (m=sqs_receive_message(queue)) != nothing + @test haskey(m, :id) && !isempty(m[:id]) @test m[:message] == "test message" end end @@ -87,4 +90,4 @@ end end end -cleanup_queues() \ No newline at end of file +cleanup_queues()