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
Salesforce Functions (Java)で実装はどう変わるか
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
CLB
July 01, 2022
Programming
550
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Salesforce Functions (Java)で 実装はどう変わるか
Salesforce Functions の実装を試しました。
・ライブラリーの使用方法
・並列実行
CLB
July 01, 2022
More Decks by CLB
See All by CLB
Salesforce 大規模開発で留意するトピック集
altyjp
0
1.3k
Other Decks in Programming
See All in Programming
すこし踏み込む CancellationToken
htkym
2
1.3k
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.5k
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
7
5k
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.5k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.2k
スマート反転とウェブアクセシビリティ
camiha
0
220
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
350
Java 27新機能 / Java 27 new features
kishida
2
180
アクセシビリティから考える情報設計
high_g_engineer
0
420
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
590
Security issues being discussed on Web Platforms
petamoriken
0
1.3k
iOSDCのペンライトを自動制御したい!
akkeylab
0
120
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Git: the NoSQL Database
bkeepers
PRO
432
67k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
510
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
700
Rails Girls Zürich Keynote
gr2m
96
14k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
560
Building an army of robots
kneath
307
47k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
It's Worth the Effort
3n
188
29k
Paper Plane
katiecoart
PRO
4
53k
Transcript
Salesforce functions (Java) で 実装はどう変わるか Sato Ryo
Hello! Sato Ryoです。(左はクレオです。) 仕事: ´ バックエンド( 業務処理の開発担当) です。 ´ Salesforce
歴 2.5 年くらいの初⼼者です。 趣味: • ネコ • キャンプ @altyjp
Salesforce functions GA 🎉 https://developer.salesforce.com/docs/platform/functions/overview
Java版の資料は少ない Node.js 版についてはいくつか資料がありますが、 Java版は資料が少ないように思います。 ´ クイックスタートガイド ´ https://developer.salesforce.com/docs/platform/functions/guide/create-function.html ´ しょっさん(Salesforce
の中の⼈)のブログ記事 ´ https://zenn.dev/sho7650/articles/f1b0c096847277 →Java 版を利⽤して気になった事を 検証していきたいと思います。
お品書き ´ ライブラリってどうなってるの︖ ´ 並列処理はできる︖効果ある︖ なお、実際のソースコードは以下にあります。 是⾮お試しください。 https://github.com/altyjp/Trying-SF-functions 注意事項︓ 問題により実際のFunctions
へのデプロイができなかったため、 本発表における実⾏時間などの値はローカル環境(MacBookAir 2018, Core i5, 8GB RAM)での実⾏結果を利⽤しております。 あくまで参考結果としてご覧ください。
ライブラリってどうなってるの︖ ´ Java で function を作成すると左記のようなファ イルが⽣成されます。 ´ Mavenを利⽤しているので、pom.xml に使いたい
ライブラリを記載することで利⽤する事ができます。
ライブラリが利⽤できるメリット ´ Apexではcsvなどを扱うライブラリ が無いため ⾃前で処理が必要になる。 ´ ライブラリを利⽤することで 安全かつ効率的にコーディング可 能。 //
opencsv で書き出す。 beanToCsv.write(accounts); // 出⼒ LOGGER.info(writer.toString()); // Account を Csv にする。 for(Account acc : accountList){ String accountId = acc.Id; String accountName = acc.Name; // ⾃前で組み⽴てが必要 String csvRow = '"' + accountId + '","' + accountName + '"'; csvStr.add(csvRow); } System.debug(csvStr); LibrarysampleFunction.java withoutLibrary.apex
並列実⾏は利⽤できる︖ 効果は︖
Apexでは並列処理を実装できないので ´ 重い処理でもforを利⽤しないといけない。 // 1000から5999までの素数を⾒つける for (Integer num : intList){
Boolean isPrime = true; for (Integer i = 2; i < num; i++) { if (Math.mod(num, i) == 0){ isPrime = false; break; } } // System.LimitException: Apex CPU time limit exceeded(10s以上) if (isPrime) { System.debug(num); } } processList.apex
Functions なら重い処理も爆速 ´ parallelStreamを利⽤して、複数のスレッドで処理を分散可能。 ´ 重い処理も⽐較にならない速度で実⾏できます。 ちなみに以下の処理、どのくらいの時間で終わると思いますか︖ // 1000から5999までの素数を⾒つける。 intList.parallelStream()
.filter(n -> isPrime(n)) .forEach(System.out::println); ParallelexecutionFunction.java
まとめ ´ ライブラリを利⽤することで安全かつ効率的に実装が⾏える。 ´ 特にCSVやyamlなどテキストデータを処理する場合。 ´ 他にはエクセル(.xlsx)などのこれまで対応できなかったバイナリファイルなども。 ´ 重い処理も並列実⾏で⾼速に実⾏できる。 ´
これにより、今までガバナ制限によって不可能だった処理も 1トランザクションで実⾏可能になるかもしれない。
Thank you!