Skip to content

Commit

Permalink
Try #24:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Jun 23, 2020
2 parents 6a7d3f1 + 8c2c225 commit e9aaa32
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/AWSSQS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```
Expand All @@ -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


Expand Down
5 changes: 4 additions & 1 deletion test/queue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -87,4 +90,4 @@ end
end
end

cleanup_queues()
cleanup_queues()

0 comments on commit e9aaa32

Please sign in to comment.