Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Durable Functionsで作るモバイルアプリのサーバーレスなバックエンド for 承...
Search
Toshinori Sugita
April 20, 2018
Technology
8.8k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Durable Functionsで作るモバイルアプリのサーバーレスなバックエンド for 承認フロー / Serverless Mobile Backend using Durable Functions for approval flow
Global Azure Bootcamp 2018@TokyoのLT資料です
https://jazug.connpass.com/event/81865/
Toshinori Sugita
April 20, 2018
More Decks by Toshinori Sugita
See All by Toshinori Sugita
AIエージェント時代のPlatform as a Product —— テックリードがPdMとして回す発見・導入・計測 / Platform as a Product in the AI Agent Era
toshi0607
1
810
GKEを中心としたマルチプロダクト・マルチリージョン対応アプリケーションプラットフォームの継続的改善 / continuous improvement of GKE based application platform
toshi0607
1
240
組織を巻き込む大規模プラットフォーム移行戦略 〜50+サービスのマルチリージョン・マルチプロダクト化で学んだステークホルダー協働の実践〜 / Platform migration strategy engaging all stakeholders
toshi0607
2
8.1k
文系学部卒ソフトウェアエンジニアが Georgia Techコンピューターサイエンス修士課程で直面したもの / What a Liberal Arts Graduate Software Engineer Faced in Georgia Tech's Computer Science Master's Program
toshi0607
4
2.1k
50以上のマイクロサービスを支えるアプリケーションプラットフォームの設計・構築の後悔と進化 #CNDW2024 / regrets and evolution of application platform
toshi0607
5
9.8k
OPA and cloud resources
toshi0607
1
14k
KompalWeather: Serverless Sauna Service with Cloud Run
toshi0607
1
13k
Knativeで作るDIY FaaS / serverless days fukuoka 2019 knative workshop
toshi0607
1
5.4k
Knativeで作るDIY FaaS / serverless days tokyo 2019 knative workshop
toshi0607
5
12k
Other Decks in Technology
See All in Technology
Gifu WordPress Meetup #200 に向けて、私たちには何ができるだろうか?/ 2026-11-07 Gifu WordPress Meetup
torounit
0
170
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
6
3.1k
"AWSはちょっと苦手"でも大丈夫。AWS Blocks で手軽に作る Flutter のバックエンド #FlutterKaigi
tacck
PRO
0
160
AI Agent 時代のデータ基盤: ClickHouse で実現する 超高速分析とコスト削減の両立
jozono
0
200
AI時代に求められる優秀なTechLeadの振る舞い
pospome
11
15k
Kiro 入門 (1 つのエージェントを、どの画面からでも) | 目指せ Kiro マスター 01
inariku
PRO
3
810
[General] 개발자로 해외 기업에서 일하기
skydoves
1
300
kintoneで在庫管理システムを作るときの要件定義・設計ポイント
kai0707
0
270
あなたのDartコードは丸見えかもしれない ~reFlutterで暴くFlutterアプリの中身と多層防御~
zozotech
PRO
0
780
レガシーコードに対する loop engineering的なAI開発プロセス導入について
kubell_hr
0
270
Active Directory と Entra ID のむむむな関係
murachiakira
PRO
3
1.6k
Software Engineering in an AI-Driven World
erikjhordan_rey
0
120
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
How to train your dragon (web standard)
notwaldorf
96
6.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
Being A Developer After 40
akosma
PRO
92
590k
The agentic SEO stack - context over prompts
schlessera
0
1k
Scaling GitHub
holman
464
140k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
560
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Product Roadmaps are Hard
iamctodd
55
13k
Transcript
Durable Functionsでつくるモバイル アプリのサーバーレスなバックエンド for 承認フロー 2018/4/21 Global Azure Bootcamp 2018@Tokyo
自己紹介 • 杉田 寿憲 ◦ Toshinori Sugita ◦ toshi0607 ◦
toshi0607 ◦ toshi0607 • Software Engineer@freee ◦ 好評の Windows 版に続いて急遽リリースを決めた Mac 版アプリの開発に、Xamarin.Mac を採用し て大幅な開発効率のアップと機能の標準化を実現。 • 最近の様子 ◦ Ruby > JavaScript >>> Go >>>>>> C# • 『Extensive Xamarin』(共著)発売中!
今日のお話 • Durable Functionsが面白そうなので調べてみた • Xamarin.FormsとDurable Functionsでサンプルアプリをつくって みた • 触ってみる上で知っておくと捗りそうなポイント
今日のお話 • Durable Functionsが面白そうなので調べてみた • Xamarin.FormsとDurable Functionsでサンプルアプリをつくって みた • 触ってみる上で知っておくと捗りそうなポイント
Durable Functionsとは? • Azure Functions(、Azure WebJobs)のステートを管理する拡張機能 • コードでワークフロー(チェーン、並列実行、非同期管理などなど) を実装 •
役割の異なる3つのバインド(orchestrationClient、orchestrationTrigger、 activityTrigger)とAzure Storage(Queue、Table、BLOB)でワークフローを 制御 ※https://docs.microsoft.com/ja-jp/azure/azure-functions/durable-functions-overview
Durable Functionsとは? ※https://docs.microsoft.com/ja-jp/azure/azure-functions/durable-functions-sequence
Durable Functionsとは? GAの日も遠くなさそう
AWS(AWS Lambda)では? • AWS Step Functionsがある(Azure Logic Appsぽい?) • Amazonステートメント言語(json形式)でステートマシンを記述
• ステートにはLambda、アクティビティ(ワーカースクリプト)、エラー処 理、反復処理などを記述し、ワークフローを組み立てる ※https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/welcome.html
今日のお話 • Durable Functionsが面白そうなので調べてみた • Xamarin.FormsとDurable Functionsでサンプルアプリをつくって みた • 触ってみる上で知っておくと捗りそうなポイント
つくったアプリ • スタンプカードアプリ。ただし、スタンプ を押すのにはメールでの承認が必要 • クライアントはXamarin.Forms製のモ バイルアプリ • バックエンドはDurable Functions製
※https://github.com/toshi0607/StampCard
つくったアプリ Backend • Microsoft.NET.Sdk.Functions • Microsoft.Azure.WebJobs.Extensions.DurableTask • Microsoft.Azure.WebJobs.Extensions.SendGrid •
Microsoft.Azure.Mobile.Client ※https://github.com/toshi0607/StampCard MobileClient • Xamarin.Forms • Syncfusion.SfCalendar.XForms • Microsoft.Azure.Mobile.Client
承認フロー • CalendarDate ◦ Type: 申請ステータス ▪ Status: Reviewing、Approved、Rejected ◦
StampAt: カレンダー1日分の日付
今日のお話 • Durable Functionsが面白そうなので調べてみた • Xamarin.FormsとDurable Functionsでサンプルアプリをつくって みた • 触ってみる上で知っておくと捗りそうなポイント
各関数・バインドの役割 • オーケストレーションクライアント ◦ HttpTriggerやQueue Triggerなどで起動 ◦ オーケストレーターを操作(開始、強制終了) ◦ オーケストレーターの状態(実行中、完了など)をクエリ
◦ オーケストレーターにイベントを送信 • オーケストレーション関数 ◦ OrchestrationTriggerで起動 ◦ Table Strotageを使いながらオーケストレーションの履歴を管理する ◦ 実行履歴をチェックしながら定期的にループしている ◦ 様々な制約がある ◦ 外部イベントで実行の中断(見かけ上)を再開できる • アクティビティ関数 ◦ ActivityTriggerで起動 ◦ 標準仕様に近いFunction ※https://docs.aws.amazon.com/ja_jp/step-functions/latest/dg/welcome.html
デバッグのポイント • オーケストレーターは定期的に再実行される ◦ activityやイベント待受のawaitごとに状態をTable Storageに保存 ◦ 次回実行時にactivityが完了していたり、イベントを受信したりしていたら先に進める オーケストレーターのブレークポイントは条件付きに ログの吐き出しは条件付きに
デバッグのポイント • オーケストレーションの履歴はTable Storageに保存される • オーケストレーターのアクティビティ呼び出し、クライアントからの 呼び出しはQueue Storageを経由する • ログの保存はAzure
Functionに準ずるので、Application Insights の有効・無効に注意する Azure Storage Emulator(azurite for Mac)とAzure Storage Explorerを フル活用
外部イベントの待ち受け ※https://docs.microsoft.com/ja-jp/azure/azure-functions/durable-functions-external-events ※https://docs.microsoft.com/ja-jp/azure/azure-functions/durable-functions-timers とはいえ必要な時はタイムアウトも忘れずに (DurableOrchestrationContextのCreateTimer使用)
ふりかえり(Good) • Durable Functionsを使うのは便利で楽しいけど、実現するための 仕組みや制約を学ぶことはそれ以上に楽しかった • C#でasync/awaitを書く感覚をもたらしつつ、複雑なアーキテク チャ、ステート・実行環境の制御を隠ぺいしてくれているのは最高 にcool •
クライアントもセットで作ることでより「人の通常操作内でデータの 整合性を保つにはどうすればいいか?」という視点が持てて実感 がわいてよかった
ふりかえり(Challenge) • モバイルからも制御が複雑なバックエンドからも同じデータを触る にあたりトランザクションほしいとか思ったらデータ更新のフロー 見直した方がよいかも • サンプルなのでクライアントはコードビハインドにもりもり書いてみ ようと思って書いてみたらそれなりに後悔した • ステータス変更はプッシュ通知やポーリングなどでスタンプリクエ
ストする人の「更新」クリックに頼らないようにしたい
良質な学習リソース • [Advent Calendar 2017 Day1] Durable Functions ことはじめ ◦
まずはポータルでひととおり動かすのが楽でした ◦ プレビューかつ日々開発が進んでいるのですでに雰囲気違うかもしれません • Durable Functions の概要 (プレビュー) ◦ 公式ドキュメントの整備され具合がすごいです ◦ パターンごとのサンプル実装を動かすのもよかったです • Azure/azure-functions-durable-extension ◦ OSSなのでコードは読み放題です ◦ issueへの回答もめちゃくちゃ速かったです • Azure Serverless Computing Cookbook ◦ 2017年8月発売ながら(申し訳程度に)Durable Functionsにも言及 ◦ FunctionsのHttpTriggerしか触ったことがなかったので一からやる分にはユース ケースのイメージがつきやすくよかったです
ご清聴ありがとうございました! Durable Functionsでつくる モバイルアプリのサーバーレスなバックエンド for 承認フロー