https://docs.oracle.com/ja-jp/iaas/Content/Streaming/Concepts/streamingoverview.htm
https://oracle-japan.github.io/ocitutorials/datascience/streaming-for-beginner/
-- 1. ストリーム・プールの作成
oci streaming admin stream-pool create --generate-full-command-json-input
oci streaming admin stream-pool create \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000 \
--name pool01
oci streaming admin stream-pool list \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000 \
--query 'data.{"name":"name","id":"id","lifecycle-state":"lifecycle-state"}' \
--output table
oci streaming admin stream-pool delete \
--stream-pool-id ocid1.streampool.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--force
-- 2. ストリームの作成
oci streaming admin stream create \
--stream-pool-id ocid1.streampool.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--name stream01 \
--partitions 1 \
--retention-in-hours 24
oci streaming admin stream list \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000 \
--query 'data.{"name":"name","id":"id","lifecycle-state":"lifecycle-state"}' \
--output table
oci streaming admin stream delete \
--stream-id ocid1.stream.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--force
-- 3. メッセージの Pub/Sub
メッセージ内の key, value は Base64 エンコードする必要がある
echo "hello" | base64
echo "world" | base64
oci streaming stream message put \
--stream-id ocid1.stream.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--endpoint https://xxxxxx.streaming.us-ashburn-1.oci.oraclecloud.com \
--messages '[{"key": "aGVsbG8K", "value": "d29ybGQK"}]'
oci streaming stream cursor create-cursor \
--stream-id ocid1.stream.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--endpoint https://xxxxxx.streaming.us-ashburn-1.oci.oraclecloud.com \
--partition 0 \
--type TRIM_HORIZON
oci streaming stream message get \
--stream-id ocid1.stream.oc1.iad.000000000000000000000000000000000000000000000000000000000000 \
--endpoint https://xxxxxx.streaming.us-ashburn-1.oci.oraclecloud.com \
--cursor "xxxx"