Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cloud SQL pubsub operation dispatching
Some of the operations are dispatched through a pubsub channel, for example "List Databases". Such a request looks like this:
radimre83@cloudshell:~$ echo 0ac2015246414746697864526b68524e786b496146454f5431346a507a55674b45555641674e5041696864655442554e6b46646451452d44526c796657463062564e46417756455769734e5878454e596c784f5241644a67655f4779316458536c675741415a42576e745757686745626c31566651463539615863732d4f593732344a4f6a724a7063727062547539756568645a69493958684a4c4c44352d4c43684651563541456b776e4855524a5579744443797059455534454953452d4d443546557712a7050a8505121d636c6f756473716c2d6772616e743a636c6f756473716c2d6772616e741a8d0310021a2b2f636f6e7461696e6572732f6372656174653f776169743d31267374646572723d31267374646f75743d3122d9027b0a20202022436d64223a5b0a20202020202022696e7374616e63652f6461746162617365222c0a202020202020222d616374696f6e3d6c697374222c0a202020202020222d6c6f67746f737464657272222c0a202020202020222d73696c656e745f696e6974220a2020205d2c0a20202022496d616765223a226763722e696f2f737065636b6c652d756d6272656c6c612f6d7973716c35375f6f6e6573686f743a737065636b6c655f6f6e6573686f745f6167656e74735f32303231303630322e30325f52433030222c0a20202022486f7374436f6e666967223a7b0a2020202020202242696e6473223a5b222f6d6e742f6469736b732f6d7973716c3a2f6d7973716c222c20222f7661722f6c69622f636c6f756473716c2f6167656e74726573756c743a2f6167656e74726573756c74225d2c0a202020202020224e6574776f726b4d6f6465223a22686f7374220a2020207d0a7d2a0020202a4f6763722e696f2f737065636b6c652d756d6272656c6c612f6d7973716c35375f6f6e6573686f743a737065636b6c655f6f6e6573686f745f6167656e74735f32303231303630322e30325f524330303a2437346164393233302d633766622d346236332d626231612d623130356530313038383934420e737065636b6c652d7075627375624a23737065636b6c652d696e2d70726f642e626f73732e75732d63656e7472616c312d31305226312d37333039633562662d313133652d346235332d386335342d3330343535363336646466321a1032353134343935393133393631393836220b08bbc684860610c0f2d178 | xxd -r -p | protoc --decode_raw
This is a ReceivedMessage:
1: "RFAGFixdRkhRNxkIaFEOT14jPzUgKEUVAgNPAihdeTBUNkFddQE-DRlyfWF0bVNFAwVEWisNXxENYlxORAdJge_Gy1dXSlgWAAZBWntWWhgEbl1VfQF59aXcs-OY724JOjrJpcrpbTu9uehdZiI9XhJLLD5-LChFQV5AEkwnHURJUytDCypYEU4EISE-MD5FUw" <- AckId
2 { <- PubsubMessage
1 {
2: "cloudsql-grant:cloudsql-grant"
3 { <- various docker container options
2: 2
3: "/containers/create?wait=1&stderr=1&stdout=1"
4: "{\n \"Cmd\":[\n \"instance/database\",\n \"-action=list\",\n \"-logtostderr\",\n \"-silent_init\"\n ],\n \"Image\":\"gcr.io/speckle-umbrella/mysql57_oneshot:speckle_oneshot_agents_20210602.02_RC00\",\n \"HostConfig\":{\n \"Binds\":[\"/mnt/disks/mysql:/mysql\", \"/var/lib/cloudsql/agentresult:/agentresult\"],\n \"NetworkMode\":\"host\"\n }\n}"
5: ""
}
4: 32
5: "gcr.io/speckle-umbrella/mysql57_oneshot:speckle_oneshot_agents_20210602.02_RC00"
7: "80bc7bfe-3faf-4bc5-b218-6bb7e66b5f89" <- this is the id of the sync operation, true random 16 bytes
8: "speckle-pubsub" <- name of the project where the pubsub receiver is being hosted
9: "speckle-in-prod.boss.us-central1-10" <- where to send back the response (topic name)
10: "1-7309c5bf-113e-4b53-8c54-30455636ddf2" <- name of the virtual machine?
}
3: "2514495913961986" <- message id
4 { <- PublishTime
1: 1623270203
2: 253000000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment