Skip to content

Instantly share code, notes, and snippets.

@Opalo
Created February 21, 2019 10:43
Show Gist options
  • Save Opalo/b6d5c69977b5fc05e882907ef3881c39 to your computer and use it in GitHub Desktop.
Save Opalo/b6d5c69977b5fc05e882907ef3881c39 to your computer and use it in GitHub Desktop.
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with defaults
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo
{
"Messages": [
{
"MessageId": "aa5b9bfc-1960-426b-bffe-89fe7a365e95",
"ReceiptHandle": "aa5b9bfc-1960-426b-bffe-89fe7a365e95#8020ee14-a1d0-41fd-89ce-b8e8807b64b0",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever"
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with All attibutes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo --attribute-names All
{
"Messages": [
{
"MessageId": "aa5b9bfc-1960-426b-bffe-89fe7a365e95",
"ReceiptHandle": "aa5b9bfc-1960-426b-bffe-89fe7a365e95#f9d79f77-d14d-41d7-88d1-73b438853d6c",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever",
"Attributes": {
"SentTimestamp": "1550741518870",
"ApproximateReceiveCount": "3",
"ApproximateFirstReceiveTimestamp": "1550741992364",
"SenderId": "127.0.0.1",
"MessageDeduplicationId": "85738f8f9a7f1b04b5329c590ebcb9e425925c6d0984089c43a022de4f19c281",
"MessageGroupId": "test"
}
}
]
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with All message attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo --message-attribute-names All
{
"Messages": [
{
"MessageId": "aa5b9bfc-1960-426b-bffe-89fe7a365e95",
"ReceiptHandle": "aa5b9bfc-1960-426b-bffe-89fe7a365e95#c63e02e3-a83b-4942-a3f7-08e91b0f1d52",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageAttributes": {
"type": {
"StringValue": "create-business",
"DataType": "String"
}
}
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with all attributes and message attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo --attribute-names All --message-attribute-names All
{
"Messages": [
{
"MessageId": "aa5b9bfc-1960-426b-bffe-89fe7a365e95",
"ReceiptHandle": "aa5b9bfc-1960-426b-bffe-89fe7a365e95#dedbc9cb-061d-4b1a-b633-454254011a91",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever",
"Attributes": {
"SentTimestamp": "1550741518870",
"ApproximateReceiveCount": "5",
"ApproximateFirstReceiveTimestamp": "1550741992364",
"SenderId": "127.0.0.1",
"MessageDeduplicationId": "85738f8f9a7f1b04b5329c590ebcb9e425925c6d0984089c43a022de4f19c281",
"MessageGroupId": "test"
},
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageAttributes": {
"type": {
"StringValue": "create-business",
"DataType": "String"
}
}
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 send-message --queue-url http://localhost:9324/queue/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "95257d6a-2faa-4206-bdb8-6eb5fb892023"
}
// receive a message with selected message attributes
 /tmp/ aws sqs --region eu-central-1 --endpoint-url http://localhost:9324 receive-message --queue-url http://localhost:9324/queue/lol6.fifo --message-attribute-names type
{
"Messages": [
{
"MessageId": "aa5b9bfc-1960-426b-bffe-89fe7a365e95",
"ReceiptHandle": "aa5b9bfc-1960-426b-bffe-89fe7a365e95#f74c073f-a011-4432-abd9-8991b764cd8c",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageAttributes": {
"type": {
"StringValue": "create-business",
"DataType": "String"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment