Skip to content

Commit

Permalink
Add FIFO-related params to SendMessage (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3QUone authored Jan 22, 2024
1 parent cc6c6af commit 8ece761
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion aiosqs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,26 @@ async def get_queue_url(self, queue_name: str) -> GetQueueUrlResponse:
}
return await self.request(params=params)

async def send_message(self, queue_url: str, message_body: str, delay_seconds: int = 0) -> SendMessageResponse:
async def send_message(
self,
queue_url: str,
message_body: str,
delay_seconds: int = 0,
message_group_id: str = None,
message_deduplication_id: str = None,
) -> SendMessageResponse:
"""https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html"""
params = {
"Action": "SendMessage",
"DelaySeconds": delay_seconds,
"MessageBody": message_body,
"QueueUrl": queue_url,
}
# Only for FIFO queues
if message_group_id:
params["MessageGroupId"] = message_group_id
if message_deduplication_id:
params["MessageDeduplicationId"] = message_deduplication_id
return await self.request(params=params)

async def receive_message(
Expand Down

0 comments on commit 8ece761

Please sign in to comment.