Skip to content

Instantly share code, notes, and snippets.

@Opalo
Created February 21, 2019 10:50
Show Gist options
  • Save Opalo/759cb6bf5fdcdf02020cb07915d7957a to your computer and use it in GitHub Desktop.
Save Opalo/759cb6bf5fdcdf02020cb07915d7957a to your computer and use it in GitHub Desktop.
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "008c5926ca861023c1d2a36653fd88e2",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "8454623c-6fdf-46f2-bdb6-5d6cbfd863d6",
"SequenceNumber": "18843733094220783616"
}
// receive a message with defaults
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo
{
"Messages": [
{
"MessageId": "8454623c-6fdf-46f2-bdb6-5d6cbfd863d6",
"ReceiptHandle": "AQEBexaWyi9DgKnXwJM/FJkhDF9Y1a1KNc4BPoiyWWd+Wq1rN/KLiX/UOUxO1PvzwgedYK0iHSWlLBF3vDdg4TcuDFJGg8IX2jTsptn5skrqK4gIHKvcMzM73Ld6kFSXl9t5TPAIVrkFcTY4ehOb5Y1fSMP7K55bNN3/kfDLlfE6ah/y24k+MNheXrCRfbDApOkOX+7COMPmqFNhfgS6Rqh62Oujl8N05zShjL5cuokNzlmXJZuXir7Ak2FATFP7y9YJjbXupSrlHjNeWvHuNvrTVg==",
"MD5OfBody": "008c5926ca861023c1d2a36653fd88e2",
"Body": "whatever"
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever2" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "9cc5f0eb38acb25dc4a5e924c7ca3d74",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "2ce768cd-53b0-4d04-9c8c-d2dc20d5ee8b",
"SequenceNumber": "18843733106812911872"
}
// receive a message with all attributes
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --attribute-names All
{
"Messages": [
{
"MessageId": "2ce768cd-53b0-4d04-9c8c-d2dc20d5ee8b",
"ReceiptHandle": "AQEBDav0Zc63Fy2wmBdVyadw8lLPPIlkWtX3wOlwPX4sKNfD7kauRocI/C+DKp/JlL+Q9QKaEOnJfhO4JXQc6/ca/NxT8pIGBZM0oTAmePRNtxQRMPUIFBW8XkWIUtS4TAUrkQ17g47EQMRJ1gMw/hIucIZc3UwVXH0BjX1PFaZmIp2RSsLMuiupFs8REIUCSrPDb0CgoeZyMTs0AJPQoXgRidbRURedVah/IZhZxaaKS3a7hqh6zvbgqmGVmeplEEwscJzokC5czpm96ulqGcri/w==",
"MD5OfBody": "9cc5f0eb38acb25dc4a5e924c7ca3d74",
"Body": "whatever2",
"Attributes": {
"SenderId": "906175111765",
"ApproximateFirstReceiveTimestamp": "1550738425559",
"ApproximateReceiveCount": "1",
"SentTimestamp": "1550738410560",
"SequenceNumber": "18843733106812911872",
"MessageDeduplicationId": "dd32a889ea2fe308ca97ab1bf9ad9576c4862a09c35624136efd5e8c71f3bde7",
"MessageGroupId": "test"
}
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever3" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "06f3d5a1f25d7e468bd3d45635c702bb",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "9b60dcf0-5697-427a-9155-85a03e454813",
"SequenceNumber": "18843733125838831616"
}
// receive a message with all message attributes
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-attribute-names All
{
"Messages": [
{
"MessageId": "9b60dcf0-5697-427a-9155-85a03e454813",
"ReceiptHandle": "AQEBBUSXfOv0COl+1lrADJrfVDEHTsCOhrmnSER22FD/n4/uwhW9RDXgqkXhxbDCShvvaFWnXzSvS0t2AHojR9nDCwyYPzbKz07xwqQzcHETT+b0RjU3mRUgGuKmjiybXsVx/dnb7DvjvcQX332qM+jyaiwcAIXJQ0jrD0xeoa+O/17GI2fJNcjFNN5kTe0QqQmjr0LifGFdRfmyw393AGE9QdgvpE9+t9DuPhH56M+7+ludebXmT+SPi6sQEqTtX79QZtQc7awUmGXFC+SzCi3nMw==",
"MD5OfBody": "06f3d5a1f25d7e468bd3d45635c702bb",
"Body": "whatever3",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageAttributes": {
"type": {
"StringValue": "create-business",
"DataType": "String"
}
}
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever4" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "8c5b01b2660998c14857eedcc920059d",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "0b6e80c7-707b-4641-ae39-f8057b30fcc0",
"SequenceNumber": "18843733188332271616"
}
// receive a message with all attributes and message attributes
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-attribute-names All --attribute-names All
{
"Messages": [
{
"MessageId": "0b6e80c7-707b-4641-ae39-f8057b30fcc0",
"ReceiptHandle": "AQEBrc7krAnKV18e/Ul+X2Ok8hf15yUaZ2L8/2lC1DfpnUDiYAU639q9KdESbFxizqXCzs4iQVcV3ad0ArD+US0PmcUd2QtYZV6N7Htevjk/Xrr6JAp+hH9KSLzv8lNJA5AGy1S+IOW1DrhidX8zXI2l9IRYZsQSjLDKoVG9uGRlMDeLb4wylRc4cbDBu1JAZjcdE18QnP9kTezopxIWsiyMx9TkWv5/f1ZhuNRbF7UygcmSkGouYJ5qWI70wWu5xjB3lPC8RiOgwThEPP0UqUeckw==",
"MD5OfBody": "8c5b01b2660998c14857eedcc920059d",
"Body": "whatever4",
"Attributes": {
"SenderId": "906175111765",
"ApproximateFirstReceiveTimestamp": "1550738739822",
"ApproximateReceiveCount": "1",
"SentTimestamp": "1550738728995",
"SequenceNumber": "18843733188332271616",
"MessageDeduplicationId": "773c5d8020c8dc8802608eb17b4ce4a6f9fc1b337943dad0d93762fa846b62b4",
"MessageGroupId": "test"
},
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageAttributes": {
"type": {
"StringValue": "create-business",
"DataType": "String"
}
}
}
]
}
// create a message with attributes
 /tmp/ aws sqs --region eu-central-1 send-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-body "whatever3" --message-group-id "test" --message-attributes '{"type" : {"DataType":"String","StringValue":"create-business"}}'
{
"MD5OfMessageBody": "06f3d5a1f25d7e468bd3d45635c702bb",
"MD5OfMessageAttributes": "31aba405fb733300db1a9e7a7e850f54",
"MessageId": "60df8849-825b-44c9-a9c1-ee5ee2e29979",
"SequenceNumber": "18843733279075567616"
}
// receive a message with filtered attributes
 /tmp/ aws sqs --region eu-central-1 receive-message --queue-url https://eu-central-1.queue.amazonaws.com/906175111765/lol6.fifo --message-attribute-names type
{
"Messages": [
{
"MessageId": "8351b641-694c-476c-8c53-cd471267ae29",
"ReceiptHandle": "AQEBFCiO/MtG0q1695MsxdRkAFT7LHW2PVKlv1SY8ol8o1oQZ94Dl0ywtKxbZfbhp+76AHSKDk/BBCf7FdVgGcEpRyKEiuj+qkh++XMPCN5h9Ehzv2W5cq4XA6/0bhsmBivBk7ZgSbYps3yHMe6lZ/zaXrxNMBRPtqdYizDUmR/n29tFWqhp3LbZxdNM3dIUjCMP1gFAqqbtmuxptzMmavGI9niqd9pkYHPmzmuGyM59Hay94T1QZWMl2GhFq3OY+DKjB6snSvCgE22DhrVTV5tzRQ==",
"MD5OfBody": "06f3d5a1f25d7e468bd3d45635c702bb",
"Body": "whatever3",
"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