affiliates. All rights reserved. | order -func Inventory -app 在庫マスタ 処理履歴 API 注文 在庫修正 注文 キャンセル Streaming Autonomous Database Functions API Gateway ② Idempotency Key + 注文 をイベントとして送信 No SQL Database ① 注文情報を取得 ③ Idempotency Key で重複確認 ④ Idempotency Key と在庫更新を同時処理 Virtual Machine 22
reserved. | Order Function Order Consumer Order Provider handleRequest() consumeMessages() order() putMessages() getRow() ack() ここでConsumeが確定 同じトランザクション order -func Inventory -app inventory idempotency commit() UPDATE inventory INSERT INTO idempotency begin() 23
All rights reserved. | Order Function Order Consumer Order Provider handleRequest() consumeMessages() order() putMessages() getRow() Consumeされないまま残る order -func Inventory -app Idempotencyと在庫処理は完了 エラーで落ちる (強引に例外発生) commit() begin() inventory idempotency UPDATE inventory INSERT INTO idempotency 25
rights reserved. | Order Function Order Consumer Order Provider handleRequest() consumeMessages() order() putMessages() getRow() ack() Consume漏れのイベントをConsume 重複のイベントのため一意制約 違反として更新処理をロールバック order -func Inventory -app rollback() begin() inventory idempotency UPDATE inventory INSERT INTO idempotency 26
rights reserved. | Order Function Order Consumer Order Provider handleRequest() consumeMessages() order() putMessages() getRow() order -func Inventory -app 同じイベントを再度更新してしまう ack() Consume漏れのイベントをConsume commit() begin() inventory UPDATE inventory 27
All rights reserved. | Java OracleClient client = new OracleRDBMSClient(); db = client.getDatabase(jdbcConn); OracleCollection col = db.admin.createCollection("purchase_orders"); col.admin().drop(); Node.js conn = await oracledb.getConnection(…); db = conn.getSodaDatabase(); col = await db.createCollection("purchase_orders"); await col.drop(); PL/SQL (and Oracle Application Express) col := dbms_soda.create_collection('purchase_orders'); select dbms_soda.drop_collection('purchase_orders') from dual; Python conn =cx_Oracle.connect(…); db = conn.getSodaDatabase(); col = db.createCollection("purchase_orders"); col.drop(); 49
rights reserved. | MGR EMPNO ENAME JOB HIREDATE SAL COMM DEPTNO employeeNumber name profile job hireDate salary EMP表 変換後のJSONの構造 SELECT 'application/json', json_object( 'employeeNumber' VALUE e.empno, 'name' VALUE e.ename, 'profile' VALUE json_object( 'job' VALUE e.job, 'hireDate' VALUE e.hiredate, 'salary' VALUE e.sal ) ) FROM emp e WHERE e.empno = :empno 設定するSQLリソース・ハンドラ https://adbhostname/ords/demo01/hr/json/sample/:empno ORDSテンプレートのURI 55