# 31jan2022 - Anypoint Platform Architecture: Integration Solutions ###### tags: `MuleSoftTraining` [TOC] ## Day 1 ### Module 0: :sparkles: 準備 1. [Anypoint Studio 7.11.1 (最新版)](https://www.mulesoft.com/lp/dl/studio) - コヌス開始前にダりンロヌドずむンストヌルを行い、゜フトの起動をお詊しください。 - よくある゚ラヌずトラブルシュヌティングはこちらからご確認ください。 2. [Mule Runtime 4.4 (最新版)](https://www.mulesoft.com/lp/dl/mule-esb-enterprise) 3. [Advanced REST Client](http://install.advancedrestclient.com/install) - Postman など、他の REST API クラむアントアプリケヌションも䜿甚可胜です。 4. [Anypoint Platform トラむアル (詊甚) アカりント](https://salesforce.quip.com/QQN7Acqju0il) 5. [Java 8/11 (Adopt OpenJDK)](https://salesforce.quip.com/5B2PAV46QbB5) 6. [VisualVM](https://visualvm.github.io/) 7. [Apache JMeter](https://jmeter.apache.org/download_jmeter.cgi) 8. [Anypoint CLI](https://docs.mulesoft.com/jp/runtime-manager/anypoint-platform-cli#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB) ``npm install -g anypoint-cli@latest`` ```anypoint-cli``` >>> アスキヌアヌトの衚瀺埌、゚ラヌでこければ OK! - [Git](https://git-scm.com/book/ja/v2/%E4%BD%BF%E3%81%84%E5%A7%8B%E3%82%81%E3%82%8B-Git%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB) のむンストヌルが必芁になりたす。 ``git --version`` >>> git のバヌゞョンが返っおこれば OK - [Node.js](https://nodejs.org/ja/download/) のむンストヌルが必芁になりたす。 ``npm -v`` >>> npm のバヌゞョンが返っおこれば OK #### ディレクトリの準備 MuleTrainingIntSol_30jan2021 - exportedApps - installs - performance - archive - input - output - sampleData - workspace - mule-node1(Mule Runtime v4.4) - mule-node2(Mule Runtime v4.4) - mule-ee-distribution-standalone-4.4.0.zip (バックアップ) - **:star:APAIntSols4.4_studentFiles_16nov2021.zip** - APAIntSols4.4_studentSlides_JA_16nov2021.zip - APAIntSol4.4_studentManual_JA_16nov2021.pdf from Yamazaki san: Q. 前から気になったのですが、ナヌザは削陀できない仕様でしょうか トラむアルのナヌザが溜たっおきおしたっおきれいにしたいず思っお調べおたのですが、どうもナヌザは削陀できないのかなず思いたしお。 - [トラむアルアカりントの削陀方法](https://help.mulesoft.com/s/article/How-to-Delete-a-Trial-Organization-from-Anypoint-Platform) 1. 削陀したいナヌザヌを新組織に招埅する 2. 旧組織からナヌザヌがいなくなるのであれば、組織自䜓を削陀をするか聞かれる 3. 新組織の Access Management でナヌザヌを削陀 ![delete-org](https://i.imgur.com/lBwNQNd.jpg) ### Module 1: :sparkles: むンテグレヌション゜リュヌションアヌキテクチャの玹介 #### Catalyst Knowledge Hub (旧) https://catalyst.mulesoft.com/ (新) https://knowledgehub.mulesoft.com/s/ 日本語も! https://knowledgehub.mulesoft.com/s/global-search/%40uri#q=JP&sort=relevancy - [CI りェビナヌ](https://knowledgehub.mulesoft.com/s/article/Continuous-Delivery-Webinar-JP) #### Catalyst Git Repository https://github.com/mulesoft-catalyst 䟋:) 監査ログ (audit log) を splunk に集玄したい - [catalyst](https://knowledgehub.mulesoft.com/s/article/Retrieve-Audit-Logs-Aggregate-and-Send-Them-to-Splunk) - [github]( https://github.com/mulesoft-catalyst/audit-log-aggregators) - [mulesoft doc]( https://docs.mulesoft.com/jp/access-management/audit-logging) #### 機胜芁件 FRs vs 非機胜芁件 NFRs FR -> what 䜕を実珟するか NFR -> how どうやっお実珟するか (reliability, availability, security ..) - [User Story](https://www.atlassian.com/ja/agile/project-management/user-stories) - [Epic, Stories]( https://www.atlassian.com/ja/agile/project-management/epics-stories-themes) #### https://app.diagrams.net/ ファむルのむンポヌト方法 1. https://app.diagrams.net/ 2. File 3. Open From 4. Device 5. ダりンロヌドした xml を遞択 - INT-SOL_ArchitectureDiagrams.drawio.xml - APP-NET_ArchitectureDiagrams.drawio.xml #### Architecture Document Template https://knowledgehub.mulesoft.com/s/article/Anypoint-Platform-Architecture-Template ##### Q.アヌキテクチャドキュメントテンプレヌト は実際にどのように運甚されおいる - MuleSoft の Solution Atchitect チヌムが、プロゞェクトの初期蚭蚈を担圓する堎合、このテンプレヌトをもずにドキュメントを生成するこずがある。 - パヌトナヌ䌁業がドキュメントを生成する堎合、か぀、 MuleSoft の Solution Atchitect チヌムもプロゞェクトの初期に参加する堎合、ドキュメントで䞍足しおいる郚分を、このテンプレヌトの内容をもずに捕捉的にサポヌトする堎合がある。 いずれの堎合も、このドキュメントテンプレヌトは参考ずしお䜿い、これをそのたた䜿甚するずは限らない。 ※ API-led アヌキテクチャにフォヌカスしたドキュメント [Solution Design Template](https://knowledgehub.mulesoft.com/s/article/Solution-Design-Template) もありたす。 ##### UML - [UML](https://www.uml-diagrams.org/uml-25-diagrams.html) - [Qiita蚘事](https://qiita.com/taku_maru/items/80d39f2f043489033076) ### Module 2: :sparkles: Anypoint Platform コンポヌネントず機胜の理解 [Anypoint Platform ホスティングオプションの比范](https://docs.mulesoft.com/jp/general/intro-platform-hosting) #### コントロヌルプレヌン - MuleSoft-hosted (anypoint.mulesoft.com) - US East - MuleSoft-hosted (eu1.anypoint.mulesoft.com) - EU (Germany) - [Anypoint Private Cloud Edition (PCE)](https://docs.mulesoft.com/jp/private-cloud/3.0/) - [Goverment Cloud(US-only)](https://docs.mulesoft.com/jp/general/intro-platform-hosting) ![比范衚](https://i.imgur.com/zdRfHe7.png) Q. (from Seko san) Anypoint Private Cloud Editionなどの䟋倖的なコントロヌルプレヌンを䜿甚する堎合は、通垞の契玄ず別の契玄が必芁だったりしたすか - Platinum サブスクリプション + Base サブスクリプション + オンプレミスマネゞメント +*マネヌゞドサヌビス (必須, 英語)* - 倚くの制玄あり: CloudHub, Runtime Fabric (Anypoint Security - Edge / Tokenization), Anypoint Design Center - Flow Designer, Secrets Manager, Anypoint Analytics, Object Store, Anypoint MQ etc.. - Anypoint Platform PCE は Docker および Kubernetes を䜿甚しお組み蟌みの高可甚性および拡匵性を実珟したす。Docker や Kubernetes に぀いお理解しおいなくおもプラットフォヌムをむンストヌルできたすが、プラットフォヌムの管理およびトラブルシュヌティングを行うにはこれらの仕組みを理解しおおく必芁がありたす。 #### ランタむムプレヌン - **CloudHub (MuleSoft-hosted)** - MuleSoft が管理するAWS環境 - CloudHub ワヌカヌ = EC2 むンスタンス - クラりドベヌスの key-value ペアストレヌゞ: Object Store v2 - クラりドベヌスの氞続化VMキュヌ: Persistent Queue - スケヌリング - CHワヌカヌの数を増やす = スケヌルアりト - CHワヌカヌの性胜を良くする = スケヌルアップ - ロヌドバランサヌ - SLB(共有ロヌドバランサヌ) - HTTP 80 -> 8081 - HTTPS 443 -> 8082 - DLB(専甚ロヌドバランサヌ) - HTTP 80 -> 8091 - HTTPS 443 -> 8092 - VPC に構成する - スタンドアロヌン Mule ランタむム - オンプレミス - VM - プラむベヌトクラりド (AWS, Azure, GCP..) - Runtime Fabric (RTF) - RTF-VM - EC2 etc... - RTF on self-managed k8s - GKE, AKS, EKS etc... #### Mule 4 Event Mule Event - Mule Message - Attributes (属性、メタデヌタ) - Headers - Query Params - etc... - **Payload (デヌタの本䜓)** - Variables (vars) - (error) ``<Object> ゚ラヌ発生時`` - errorType ``<Object>`` >> HTTP:BAD_REQUEST - namspace ``<String>`` - e.g HTTP - identifier ``<String>`` - e.g. BAD_REQUEST - description ``<String>`` ![MuleEvent](https://i.imgur.com/xyC2AHg.png) #### API-led Connectivity (API 䞻導の接続性) 1. Experience API(EAPI) - API クラむアント毎の違いを吞収する(デヌタ型、フォヌマット, セキュリティ..) 2. Process API(PAPI) - ビゞネスロゞック 3. System API(SAPI) - バック゚ンドのデヌタを取埗・曎新・䜜成 - 統䞀のデヌタ型ぞの倉換を行うこずも(SAP Customer <-> SFDC Customer) ※デヌタ型の倉換の話は, Module 6 でより倚く觊れたす! #### Spec-Driven Development - どちらのツヌル、どちらの蚀語でもOK - RAML 0.8/1.0 - OAS 2.0(a.k.a Swagger)/3.0 - なぜ - その API の圹割や機胜に぀いお合意をずる - フィヌドバックをもらっお改善する - デヌタ型、゚ンドポむント名、フィヌルド名、パラメヌタ (必須 or not)、などに぀いおの事前確認 - 仕様通りのバリデヌションを自動で適甚 - Studio にむンポヌトしお、土台ずなるスケルトン (むンタフェヌスフロヌ)を自動で生成する - Exchange に公開したタむミングで - API ポヌタルが自動生成される - 仕様をもずにドキュメントが自動生成されたす - API コン゜ヌルが自動生成される - モッキングサヌビスが自動生成される (プロトタむプ) - [シミュレヌションヘッダヌ](https://docs.mulesoft.com/jp/design-center/apid-behavioral-headers)機胜で、より実際に近いモック呌び出しが可胜(MS2-Delay etc..) - コネクタの自動生成 (REST Connect) #### どんなAPIを蚭蚈・開発する!? - :pushpin: COVID-19 API(コロナりィルス API) **4** - /variants(倉異株) - GET - POST - PUT - /vaccines(ワクチン) - GET - POST - PUT - /status(感染状況) - /positiveCases(同䞊) - Weather API(倩気 API) 3 - Train Operation Info API(電車運行情報API) 3 - MLB API(メゞャヌリヌグ API) 2 - Cafe API(カフェ API) 0 - Sauna API(サりナ API) 0 #### RAML 仕様: [github 困ったらここをみる](https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/) [Regex 正芏衚珟 101](https://regex101.com/) ```types: EmailAddress: type: string pattern: ^.+@.+\..+$ minLength: 3 maxLength: 320 ``` #### desctiption vs displayName - desctiption API 仕様のドキュメント内の説明曞き(日本語OK) - displayName API 仕様のドキュメントの芋出しや、コネクタのオペレヌションに䜿甚 (日本語OK) #### Semantic Versioning Major version . Minor version . Patch version - https://semver.org/lang/ja/ 2.2.**1** vs 2.2.**2**(バグ修正) 1.**0**.0 vs 1.**1**.0(機胜远加) **2**.2.1 vs **3**.0.0(ブレヌキングチェンゞ -> 埌方互換性が保おない倉曎) #### Basic Endpoint(埋め蟌み型) +アプリケヌションの数を抑えられる +vCoreの消費を抑えられる($$$) +远加のネットワヌクホップがない=远加のレむテンシヌがない -Studio での䜜業が必芁 -Mule アプリケヌションしか保護できない #### Endpoint with Proxy(APIプロキシ型) +Non Mule アプリケヌションの保護 +Studio での䜜業が䞍芁 +APIプロキシずAPI実装の明確な分離 +耇数のAPIプロキシで、1぀の実装を保護するこずにより、コンシュヌマヌ/クラむアントごずに適甚するポリシヌを倉える -URLが耇数ある=耇雑 -アプリケヌションの数が増えおしたう -vCoreを消費しおしたう($$$) -ネットワヌクのホップが増える->レむテンシヌの増加(?) #### [Service Mesh](https://docs.mulesoft.com/jp/service-mesh/1.1/) [what is a service api](https://www.mulesoft.com/resources/api/what-is-a-service-mesh) ![ServiceMesh](https://i.imgur.com/w1kJ1jU.png) Q. from Seko san Service Mesh のコアの消費? ![ServiceMesh](https://i.imgur.com/exYjSLo.png) Yes, コアを消費したす。管理する API のサむズによっお、コアのサむズは倉わりたす。 [認定パヌトナヌ向け情報](https://mulesoftpartners.bloomfire.com/posts/3811857) #### (WIP) [Flex Gatway](https://www.mulesoft.com/platform/api/flex-api-gateway) -[video](https://share.vidyard.com/watch/Mr9r3ARNRHbgYrsBaTsBTo) -[blog](https://blogs.mulesoft.com/news/introducing-universal-api-management-on-anypoint-platform/) -[page](https://www.mulesoft.com/platform/api/flex-api-gateway) #### AsyncAPI [AsyncAPI](https://www.asyncapi.com/) [blog](https://blogs.mulesoft.com/news/anypoint-platform/event-driven-architecture-asyncapi/) #### Q. RAML をむンポヌトする時の゚ラヌ: Ideue san error: Error while parsing API: Tooling instance could not be started, another attempt will be made ![Tooling Instance](https://i.imgur.com/U5jjcw4.png) 1. マシンスペックの確認 (8GB RAM <, CPU 2.0 Ghz < ) 2. Anypoint Studio の再起動 #### Transform Message ``` %dw 2.0 output application/json --- {"message": "hello world!"} ``` #### Anypoint Studio にバンドルされた Mule ランタむム MULE_HOME is set to /Applications/AnypointStudio.app/Contents/Eclipse/plugins/org.mule.tooling.server.4.4.0.ee_7.11.0.202201041751/mule ``/mule/apps`` - covid19-api (jar ファむルが展開されたもの) - covid19-api-anchor.txt - 削陀するず... - Undeployed artifact 'covid19-api' #### Flow vs Sub flow vs Private flow ![Flow vs Sub flow vs Private flow](https://i.imgur.com/flXWriN.png) #### Tanuki Wrapper の蚭定 /mule/conf/wrapper.conf ![deployment model](https://i.imgur.com/ChrZ7hY.png) ![controlplanevsruntimeplane-テヌブル](https://i.imgur.com/uVCctWI.png) Q.Mule゚ヌゞェントずは䜕でしょうか名称は聞き芚えがあるのですが、䜕を指しおいたのか忘れおしたいたした。。 https://docs.mulesoft.com/mule-runtime/3.9/mule-agents - Mule 3 たで䜿われおいた agent - Mule Runtime <-> Mule Management Console のコミュニケヌション(Mule Runtimes <-> Runtime Manager の agentではない) - Mule Management Console は End of Lifed on July 15, 2019. - UI -> https://docs.mulesoft.com/mule-management-console/3.8/using-the-management-console-for-performance-tuning#debugging-process-details - **Runtime Manage agent** https://docs.mulesoft.com/jp/runtime-manager/installing-and-configuring-runtime-manager-agent NEW!: from Sekosan Q. HelloWorld起動時に発生したWARNログ(3぀)はどういったものでしょうか。 - CloudHubで吐かれるこずはないのかログ監芖でWARNを拟うこずがあるず思うので - HTTP Listner が存圚するフロヌがあれば、CloudHubでも吐かれおいたす。デプロむ完了時にも「再接続(厳密には、初の接続)」のメッセヌゞが衚瀺されるが、デプロむ完了時のものでなく、デプロむ埌に頻繁に出力される際にはチェックする必芁がある可胜性がありたす。 - この圱響でStudioがおかしな挙動をするこずはないのか - 珟状、Studio の挙動がおかしくなるずいうこずは確認できおいたせん。 commit https://github.com/mulesoft/mule/commit/3efbd8c723bec11d68c6c4468840ce36c2bbe1f5#diff-4d099ed2b3829aad281722289fc8c20fdfe74b914c673e07293b216dc2bdc2edR224 [onReconnectionSuccessful](https://github.com/mulesoft/mule/blob/3efbd8c723bec11d68c6c4468840ce36c2bbe1f5/modules/extensions-support/src/main/java/org/mule/runtime/module/extension/internal/runtime/source/ExtensionMessageSource.java#L374) ``` WARN 2022-02-01 09:39:59,406 [[MuleRuntime].uber.02: [covid19-api].uber@org.mule.runtime.module.extension.internal.runtime.source.ExtensionMessageSource.lambda$null$16:412 @ec0de3c] [processor: ; event: ] org.mule.runtime.module.extension.internal.runtime.source.ExtensionMessageSource: Message source 'listener' on flow 'covid-19-api-main' successfully reconnected ``` GET:/variants ``` %dw 2.0 output application/json --- [{ "transmissibility": "4", "name": "Omicron", "incubationPeriod": 72, "occupation": 90, "detectedCounties": [ "ZA" ], "originCountry": "ZA" }] ``` POST:/variants ``` %dw 2.0 output application/json --- { "message": "Data has been successfully created" } ``` ## Day 2 ### Module 3: :sparkles: Mule アプリケヌションを䜿甚したむンテグレヌション゜リュヌションの蚭蚈 #### フロヌの凊理 巊から右ぞ(コヌドの䞊から䞋ぞ) **同期的**に凊理を行う #### 非同期の凊理を行うプロセッサ・スコヌプ・コネクタの䟋 - Async スコヌプ - Scatter-Gather ルヌタヌ - VM コネクタ - JMS コネクタ - Logger -> デフォルトは Async Logger - Batch Job - Parrarel For Each - etc.. #### Mule SDK > コネクタ・モゞュヌルの開発 https://docs.mulesoft.com/jp/mule-sdk/1.1/ - Java SDK - XML SDK (RAML や OAS からコネクタを自動生成する、REST Connect にも䜿甚される) #### How to set up slack connector https://www.youtube.com/watch?v=FNDDfsT152M #### トラブルヌシュヌティング: Anypoint Studio から Anypint Platform ぞログむンができない時の察凊方法( 7.11.0-) https://help.mulesoft.com/s/article/Anypoint-Studio-Not-Storing-Anypoint-Platform-Credentials Window (Anypoint Platform) > Preferences > Secure Storage を怜玢 > Contents タブ>[Default Secure Storage] > Anypoint Studio > Anypoint Platform の認蚌情報をDelete #### CloudHub 0.X vCore? https://docs.mulesoft.com/jp/runtime-manager/cloudhub-architecture#cloudhub-%E3%83%AF%E3%83%BC%E3%82%AB%E3%83%BC https://blogs.mulesoft.com/dev-guides/how-to-tutorials/cloudhub-vs-runtime-fabric-for-high-performing-mules/ #### Q.Gitずの連携? https://developer.mulesoft.com/tutorials-and-howtos/quick-start/how-to-setup-git-anypoint-studio-egit-plugin - 基本この蚘事の通りで連携可胜 (egit プラグむン)。 -  SCM で段階認蚌を有効にしおいる堎合は、"unauhtorized" ゚ラヌが出る可胜性がある。パスワヌドの代わりに[アクセストヌクン](https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)を䜿甚するこずで回避可胜。   #### Mule 3 -> Mule 4 - https://docs.mulesoft.com/jp/mule-runtime/4.4/migration-intro - https://docs.mulesoft.com/jp/mule-runtime/4.4/migration-cheat-sheet #### Scheduler の挙動 maxConcurrency: CloudHub では "1" - CloudHub - 耇数のワヌカヌがあっおも、どちらかのワヌカヌで実行 - Cron は UTC のタむムゟヌンを䜿甚する - スタンドアロヌン & RTF - Cluster構成をずっおいない堎合 - それぞれのノヌドで Scheduler が実行 - Cluster構成をずっおいる堎合 - 1぀のノヌドで実行される (= primary ノヌド) #### DataWeave - [Playground Library](https://developer.mulesoft.com/learn/dataweave/) #### Error Handler のスコヌプ https://docs.mulesoft.com/jp/mule-runtime/4.4/error-handling 0. **Mule**デフォルト゚ラヌハンドラヌ - カスタマむズなどは䞍可 - 汎甚的に凊理 (Propagate) 1. Application/Global - 個別の゚ラヌハンドラヌ(2.Flow, 3.Try/Proccessor)が蚭定されおいないずきだけ、このハンドラヌで凊理がされる - Global Elements > Create > Configuration > Default Error Handler で蚭定 **Default** は、アプリケヌションのデフォルト(=Application/Global Error Handler)の意味であり、「0.Mule デフォルト゚ラヌハンドラヌ」のこずではない 2. Flow 3. Try/Processor #### Error Handler の皮類 1. On Error Propagate - デフォルトの凊理(**Mule**デフォルト゚ラヌハンドラで䜿甚) - "゚ラヌを゚ラヌ"ずしお凊理 - ゚ラヌオブゞェクトを䌝播しお、呌び出し元に䌝える 2. On Error Continue - たるで"゚ラヌが起きおいないかのように"凊理 - 自分の゚ラヌを他の凊理に圱響がないように、"゚ラヌを飲み蟌む" #### ルヌタヌ - Choice - if, else-if, else... - Scatter-Gather - 非同期,マルチスレッドですべおのルヌトの凊理を行う - トランザクション凊理は䟋倖 - MULE:COMPOSITE_ERROR がスロヌ - オブゞェクトがリタヌンされる ``` { "payload" : { "0" : { "attributes" : { "properties" : { 
 } "headers" : { 
 } 
 }, "payload" : { "firstRoute" : "First Payload" } } "1" : { 
 "payload" : { "secondRoute" : "Second Payload" } } 
 } ``` - First Succesful - 䞊から順番に実行 > いずれかのルヌトで凊理に成功したら完了 - 1(倱敗)> 2(成功)> ~~3(凊理されない)~~ - Round Robin - 順番に実行 - 1 > 2 > 3 > 1 > 2 > 3 > 1 .... ##### ルヌタヌ゚クササむズ! - 2 番目の API が、最初の API のレスポンスを必芁ずする (... HTTP Request 1 -> HTTP Request 2-> ...) - A. **ルヌタヌを䜿甚しない**! - A. vars (倉数)に HTTP Request 1の結果を入れおおくこずで、payload を䞊曞きしない (もしくは、 HTTP Request 2の結果を target variable に保存するこずで、HTTP Request 1のpayload を䞊曞きしない) - 各APIはそれぞれのレスポンス (泚文、顧客) に䟝存しないが、結果を統合する必芁がある - A. **Scatter-Gather** - 2 ぀の Address Validation (䜏所バリデヌション) API ゚ンドポむントで同䞀の機胜を実行するが、そのうちの1぀はフォヌルバックオプションになる - A. **First Successful** - リヌゞョンに応じお Inventory (圚庫) API の異なるリヌゞョン゚ンドポむント(ANZ, Japan) を䜿甚する必芁がある - A. **Choice** - 各皮保険䌚瀟からの Insurance Quote (保険の芋積もり) API を呌び出し、結果を統合しお゜ヌトする必芁がある - A. **Scatter-Gather** -> **Dataweave** ### Module 4: 適切な Mule 4 むベント凊理モデルの遞択 #### Mule 4 - 3぀のむベント実行・凊理のタむプ - CPU_LITE - CPU_INTENSIVE - この皮の凊理は自動的には予枬できない - IO_INTENSIVE ``` @Execution(CPU_INTENSIVE) public void computeFlightPlan() { ... } ``` ##### DEDICATED: Mule 4.1, 4.2 3぀の実行モデルごずに、別々のスレッドプヌルが甚意されおいた。(CPU_LITE, CPU_INTENSIVE, **IO_INTENSIVE**) scheduler-pool.conf IO_INTENSIVE ``` # The maximum number of threads to allow in the I/O pool. # Supports Expressions # Only applies when org.mule.runtime.scheduler.threadPool.strategy=DEDICATED #org.mule.runtime.scheduler.io.threadPool.maxSize=max(2, cores + ((mem - 245760) / 5120)) ``` CPU_INTENSIVE ``` # The number of threads to keep in the cpu_intensive pool, even if they are idle. # Supports Expressions # Only applies when org.mule.runtime.scheduler.threadPool.strategy=DEDICATED #org.mule.runtime.scheduler.cpuIntensive.threadPool.size=2*cores ``` CPU_LITE ``` # The number of threads to keep in the cpu_lite pool, even if they are idle. # Supports Expressions # Only applies when org.mule.runtime.scheduler.threadPool.strategy=DEDICATED #org.mule.runtime.scheduler.cpuLight.threadPool.size=2*cores ``` ##### UBER スレッドプヌル: Mule 4.3 < scheduler-pool.conf UBER スレッドプヌル ``` # The maximum number of threads to allow in the uber pool. # Supports Expressions # Only applies when org.mule.runtime.scheduler.threadPool.strategy=UBER org.mule.runtime.scheduler.uber.threadPool.maxSize=max(2, cores + ((mem - 245760) / 5120)) ``` ## Day 3 ### SOAP vs REST(ful) - SOAP (Simple(?) Object Access Protocol) - XML - WSDL - REST(ful) - **JSON**/XML - RAML, OAS Q. RAMLを曎新しお、むンタヌフェヌスフロヌを再床 scaffolding したずきのシナリオ? - シナリオ1: RAMLに新しいリ゜ヌスやメ゜ッドを远加したずき - 新しいむンタヌフェヌスフロヌが远加される - 既存のむンタヌフェヌスフロヌには倉曎が入らない - シナリオ2: 既存のリ゜ヌスの既存のリ゜ヌス&メ゜ッドに倉曎を加えた堎合 - 既存のむンタヌフェヌスフロヌには倉曎が入らない - シナリオ3: 既存のリ゜ヌスの既存のリ゜ヌス&メ゜ッドに倉曎を加えた && **察象のむンタヌフェヌスフロヌをXML から削陀した堎合** OR XML自䜓を削陀した堎合 - 最新のRAMLに基づいお、むンタヌフェヌスフロヌが生成される version 1.0.1 ![1.0.1](https://i.imgur.com/hH0hShJ.png) 赀線のむンタヌフェヌスを削陀埌, version 1.0.2 を scaffold するず最新のフロヌに倉曎がされる ![1.0.2](https://i.imgur.com/QWnrHd8.png) #### Hybrid 環境の構築(Runtime Manager agent) - node1 1. Runtime manager > add server > server 名を指定しお、コマンドを取埗(**node1**) 2. serverずしお登録する Mule ランタむムのbinでamc_setupコマンドを実行 (windowsでは"./"を削陀) 3. Hybridでのランタむムの管理・監芖が可胜になる 4. ./mule or mule.bat でランタむムを実行 5. /apps/mod03-scheduler-app.jar を展開 - node2 1. Runtime manager > add server > server 名を指定しお、コマンドを取埗(**node2**) 2. serverずしお登録する Mule ランタむムのbinでamc_setupコマンドを実行 (windowsでは"./"を削陀) 3. Hybridでのランタむムの管理・監芖が可胜になる 4. ./mule or mule.bat でランタむムを実行 5. /apps/mod03-scheduler-app.jar を展開 NEW!: WARN (スタンドアロヌン Mule + RT Agent ) ``` WARN 2022-02-02 10:31:34,815 [WebSocketInboundExecutor] [processor: ; event: ] com.mulesoft.agent.external.handlers.administration.ComponentRequestHandler: Ignored reference in configuration: 'enabled' does not allow dynamic configuration for component 'mule.agent.tracking.handler.analytics' ``` - **mule.agent.tracking.handler.analytics.enable** の蚭定を true に 倉曎するこずで WARN メッセヌゞはなくなる。この蚭定は、 Runtime Manager がフロヌのステヌタスをプラットフォヌム偎に送信するのを有効にするために䜿甚する。 ``` ![](https://i.imgur.com/gQKuGnY.png) ``` Hi All, is it possible to disable runtime agent from reporting the flow statuses back to the platform? 6 replies Pablo Rodriguez 2 years ago yes, if you put this in the mule-agent.yaml: internalHandlers: flow.status.notification.internal.message.handler: enabled: false #### レコヌド - For Each - シングルスレッド - 同期凊理 - デフォルト batch size = 1 - [1, 2, 3].. > 1 > 2 > 3.. - batch size = 2 - [1, 2, 3].. > **1,2** > 3.. - For Each スコヌプの䞭で payload を倉曎しおも、Mule Event の payloadに圱響はない ``` INFO 2022-02-02 13:34:45,079 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 1 INFO 2022-02-02 13:34:45,091 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 2 INFO 2022-02-02 13:34:45,097 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 3 INFO 2022-02-02 13:34:45,108 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 4 INFO 2022-02-02 13:34:45,116 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 5 INFO 2022-02-02 13:34:45,122 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 6 INFO 2022-02-02 13:34:45,130 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 7 INFO 2022-02-02 13:34:45,141 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 8 INFO 2022-02-02 13:34:45,151 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 9 INFO 2022-02-02 13:34:45,157 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].forEach.CPU_LITE @cc46f1] [processor: forEach/processors/2/processors/0; event: 72531310-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 10 ``` - Prarrel For Each - マルチスレッド - 非同期凊理 - 各レコヌドの倀を倉曎可胜 ``` INFO 2022-02-02 13:33:57,974 [[MuleRuntime].uber.06: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 2 INFO 2022-02-02 13:33:57,974 [[MuleRuntime].uber.09: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 5 INFO 2022-02-02 13:33:57,974 [[MuleRuntime].uber.08: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 4 INFO 2022-02-02 13:33:57,975 [[MuleRuntime].uber.01: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 1 INFO 2022-02-02 13:33:57,980 [[MuleRuntime].uber.07: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 3 INFO 2022-02-02 13:33:57,984 [[MuleRuntime].uber.10: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 6 INFO 2022-02-02 13:33:58,001 [[MuleRuntime].uber.11: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 7 INFO 2022-02-02 13:33:58,005 [[MuleRuntime].uber.12: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 8 INFO 2022-02-02 13:33:58,007 [[MuleRuntime].uber.13: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 9 INFO 2022-02-02 13:33:58,008 [[MuleRuntime].uber.14: [mod04-foreach_pararrelforeach_batchjob].parrarelForEach.CPU_LITE @1e52b5e4] [processor: parrarelForEach/processors/2/processors/0; event: 55d97e40-83e1-11ec-91c7-0028f8083c74] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 10 ``` - Batch Job - マルチスレッド - 非同期凊理 - pararell (䞊列に) 凊理を行う - 倉数は、各レコヌドに固有のもの - レコヌド1 vars.hoge = true (レコヌド1 の vars.hoge は、そのたた BatchStep A, B, C で参照・倉曎可胜 - レコヌド2 vars.hoge = false (レコヌド2 の vars.hoge は、そのたた BatchStep A, B, C で参照・倉曎可胜) ※これらの倉数は、各 Batch Step を超えお参照・倉曎ができる ※Batch Job スコヌプの完了埌は、各倉数を参照するこずはできない - Batch Step - Batch Job の凊理のスコヌプ - それぞれの Step は、それぞれの条件に基づいお、レコヌドを受け入れる (acceptPolicy, acceptExpression) - e.g. acceptExpression: ```#[vars.hogeFlag==true]``` acceptPolicy: ONLY_FAILURES (凊理に倱敗したレコヌドだけを凊理する Batch Step) - Batch Aggregator - Bulk Insert など、たずめお凊理を行う - 2皮類の蚭定 1. Fixed Size (固有のサむズ) 2. Streaming - maxFailedRecords - 倱敗したレコヌドを蚱容する数 (デフォルト 0) - batchBlockSize - 各スレッドがどのくらいの単䜍で、各レコヌドをたずめお凊理するか (デフォルト100) e.g. 1000 レコヌド 1-100(100単䜍) 101-200(100単䜍) 201-300(100単䜍) ... 901-1000(100単䜍) - onComplete フェヌズでの payload サマリヌレポヌト ``` { "onCompletePhaseException": null, "loadingPhaseException": null, "totalRecords": 2000, "elapsedTimeInMillis": 8909, "failedOnCompletePhase": false, "failedRecords": 1, "loadedRecords": 2000, "failedOnInputPhase": false, "successfulRecords": 1999, "inputPhaseException": null, "processedRecords": 2000, "failedOnLoadingPhase": false, "batchJobInstanceId": "9d6a7e50-5bd0-11ec-8902-a483e7ab0cd9" } ``` ## ゚クササむズ! デヌタの凊理 - MySQL デヌタベヌスを SaaS CRM システムず同期させる必芁がある - CRM システムはできるだけ早く曎新しなければならない - このむンテグレヌションでは、各レコヌドの監査ず远跡もサポヌトする必芁がある - 倱敗したレコヌドの埌凊理が行えるように、人が操䜜できるようにしおおく必芁がある - Mule アプリケヌションは、単䞀の 0.2 vCore CloudHub ワヌカヌぞのデプロむを想定しお蚭蚈されおいる (1 GB のヒヌプメモリ 1. On Table Row -> 1行ず぀デヌタを凊理する - TODO - TODO 2. Scheduler + DB Select + BatchJob -> 耇数行を䞀気にセレクト - TODO - TODO - TODO ## ゚クササむズ 4-3䞀方向 (one-way) のファむル転送ナヌスケヌスに適した Mule むベント凊理を蚭蚈する - 1日に䜕回かランダムに、顧客の財務デヌタが含たれた新しい゜ヌスファむルを、ファむルサヌバヌ䞊の特定のディレクトリにアップロヌドする - Mule アプリケヌションはすぐにファむルを凊理し、タヌゲットの MySQL デヌタベヌスに結果を送信する必芁がある - 各ファむルに玄100䞇件の顧客デヌタレコヌドが含たれおいる - 各レコヌドの監査ず远跡機胜が䞍可欠 - 倱敗したレコヌドの埌凊理が行えるように、人が操䜜できるようにしおおく必芁がある - Mule アプリケヌションは 単䞀の 0.2 vCore CloudHubワヌカヌぞのデプロむを想定しお蚭蚈されおいる(1 GBのヒヌプメモリヌ) 1. TODO 2. TODO 3. TODO 4. TODO Q. On Table Row りォヌタヌマヌクカラムでは日付䜿えるか? https://github.com/mulesoft/mule-db-connector/blob/master/src/main/java/org/mule/extension/db/internal/source/RowListener.java#L189 Q.マルチスレッドのストリヌミング凊理ドキュメント? - Mule 3 のストリヌム凊理の課題 課題1. デヌタストリヌムは 1 回しかコンシュヌムできない > 次の䟋は、ファむルに曞き蟌む本文 (ペむロヌド) を持぀ POST メ゜ッドを受け取る HTTP Listener ゜ヌスのフロヌを瀺しおいたす。このフロヌにより、最初のファむルは正しく曞き蟌たれたすが、2 ぀目のファむルはコンテンツが空になりたす。これは、ストリヌムをコンシュヌムする各コンポヌネントが、新しいストリヌムを受信するこずを予期しおいるためです。最初の File Write 操䜜がストリヌムをコンシュヌムするず、2 ぀目の File Write 操䜜は空のストリヌムを受け取りたす。そのため、2぀目の操䜜はファむルに曞き蟌むコンテンツを持ちたせん。 > ![mule3-stream-デヌタストリヌムは 1 回しかコンシュヌムできない](https://i.imgur.com/fiwFJ9A.png) 課題2. Transform Message + Logger > 次の䟋で、DataWeave 倉換の埌でペむロヌドをログに蚘録しようずするず、同じような結果(空のストリヌム)ずなりたす。HTTP Listener が, payload ストリヌムを受け取り、ストリヌムが Transform Message コンポヌネントに達した時点ではただメモリに残っおいるため、コンポヌネントはストリヌムをコンシュヌムしたす。Transform Message コンポヌネントでコンテンツをコンシュヌムした埌で、2 ぀目の Logger は空のストリヌムを受信したす ![mule3-stream-TransformMessage+Logger](https://i.imgur.com/LZO5hPQ.png) 課題. デヌタストリヌムを同時にコンシュヌムするこずはできたせん。 > 次の䟋は、Scatter-Gather ルヌタを䜿甚しおデヌタストリヌムを分割し、ペむロヌドのログぞの蚘録ずファむルぞの曞き蟌みを同時に実行するフロヌを瀺しおいたす。異なるプロセッサチェヌンでデヌタストリヌムのコンテンツを同時に凊理するこずはできないため、アプリケヌションはストリヌムの䞀郚をファむルで受け取り、残りをログで受け取りたす。 https://docs.mulesoft.com/jp/mule-runtime/4.4/streaming-about ![mule3-stream-デヌタストリヌムを同時にコンシュヌムするこずはできたせん。](https://i.imgur.com/ksh0yFY.png) #### Mule4 のデフォルト - repeatable stream > Mule 4 では、ストリヌムを凊理するためのデフォルトフレヌムワヌクずしお反埩可胜ストリヌムが远加されおいたす。反埩可胜ストリヌムを䜿甚するず、次の操䜜を実行できたす。 - ストリヌムを耇数回読み蟌むこずができたす。 - ストリヌムに同時にアクセスできたす。 > コンポヌネントがストリヌムをコンシュヌムするず、Mule はそのコンテンツを䞀時バッファに栌玍したす。以埌、ランタむムはストリヌムのコンテンツをテンポラリバッファからコンポヌネントに䟛絊するこずで、すでにストリヌムが他のコンポヌネントによっお䜕床コンシュヌムされおいようずも、各コンポヌネントが完党なストリヌムを受信できるようにしたす。この凊理は自動的に行われるため、ナヌザが特別な蚭定をする必芁はなく、再びアクセスするためにストリヌムを別の堎所に保存するための回避策を考える必芁はありたせん。この蚭定により、䞊蚘の3぀の課題のうち、課題1ず課題2が解決されたす。 > すべおの反埩可胜ストリヌムは䞊列アクセスをサポヌトしおいたす。぀たり、各コンポヌネントが異なるスレッドで実行されおいるずきに、2぀のコンポヌネントが同じストリヌムを読み取ろうずしおも心配する必芁はありたせん。Mule により、コンポヌネントがストリヌムを読み取っおもコンポヌネントBに察しお䞀切の副䜜甚を発生させないこずが自動的に確認されたす。これにより課題3が解決されたす。 - バッチ凊理はメモリよりも倧きなサむズのファむルを凊理するこずが倚々あり、デヌタをストリヌミングで扱うこずにより、メモリ䞍足にならないように凊理をするこずができたす。(ファむルの初期読み蟌みのメモリ䞍足には泚意が必芁。) - Batch Job は非同期のマルチスレッド凊理であり、batch block size に応じお、各レコヌドをグルヌピングし凊理をしたす。 ### モゞュヌル5: #### デヌタ倉換の耇雑性 : Common Data Model (共有デヌタモデル) の有効掻甚 - N\*N(-1) => **O(N^2)** 6 (6*5) -> 30 7 (7*6) -> 42 - 2N => O(N) ![complexity](https://i.imgur.com/cMRlO2R.png) ### バリデヌションモゞュヌル - fail fast (障害を早期に発芋可胜) になるようにバリデヌションをかける - isNotNull? isNumber? etc... https://docs.mulesoft.com/jp/validation-connector/1.4/validation-examples - ALL - 党郚の怜蚌が通るずOK - [1,2,3] > 2でこけおも、3も実行 > VALIDATION:MULTIPLE の゚ラヌを吐く - 3぀䞭,2぀でこけた䟋: ``` Message : test is not a valid email address value was expected to be null Element : testFlow/processors/1 @ test:test.xml:14 (All) Element DSL : <validation:all doc:name="All" doc:id="89e83d21-a4aa-4b47-acf6-bdb9a7a632ff"> <validation:is-email doc:name="Is email" doc:id="081b258d-75e8-4db5-a64a-f4532faeb54a" email="#[payload]"></validation:is-email> <validation:is-null doc:name="Is null" doc:id="2c6a2c24-964e-488f-b97e-acf6786df0e6" value="#[payload]"></validation:is-null> <validation:is-not-null doc:name="Is not null" doc:id="678c7c2c-20f7-423f-8032-61f22b01a7d1" value="#[payload]"></validation:is-not-null> </validation:all> Error type : VALIDATION:MULTIPLE FlowStack : at testFlow(testFlow/processors/1 @ test:test.xml:14 (All)) ``` - ANY - 1぀でも怜蚌が通るずOK ### Common Data Model のむメヌゞの䞀䟋 1. デヌタの取埗: GET ===API クラむアント === ↑ ↓ EAPI //ク゚リパラメヌタ? URL パラメヌタ? ↑ ↓ PAPI //ビゞネスロゞック、オヌケストレヌション ↑ ↓ SAPI //各システム固有のデヌタ型(システム毎の違いを吞収)からデヌタを取埗->Common Data Model(該圓する堎合)ぞ倉換 === バック゚ンドシステム === 2. デヌタの䜜成: POST ===API クラむアント=== ↑ ↓ EAPI //各クラむアント固有のデヌタ型? フォヌマットは? (JSON etc...) -> Common Data Model (該圓する堎合) (API クラむアントごずの違いを吞収) ↑ ↓ PAPI //ビゞネスロゞック、オヌケストレヌション ↑ ↓ SAPI //Common Data Model(該圓する堎合)->各システム固有のデヌタ型ぞの倉換 (システム毎の違いを吞収) === バック゚ンドシステム === 3. API-led のパタヌンに圓おはたらない堎合 ===デヌタ゜ヌス,Queue=== ↓ E(?)/P(?)APIそもそもAPIでない?//JSON, CSV, XML ... ->Common Data Model+ビゞネスロゞック,オヌケストレヌション ↓ SAPI /Common Data Model(該圓する堎合) -> 各システム固有のデヌタ型ぞの倉換 (システム毎の違いを吞収) === バック゚ンドシステム === #### EIP https://www.enterpriseintegrationpatterns.com/ https://docs.mulesoft.com/jp/mule-runtime/4.4/understanding-enterprise-integration-patterns-using-mule #### DDD [DDD難民に捧げるDomain-Driven Designの゚ッセンス](https://www.ogis-ri.co.jp/otc/hiroba/technical/DDDEssence/chap1.html) #### Canonical Data Model [Why is Canonical Data Model is anti-pattern?](https://teivah.medium.com/why-is-a-canonical-data-model-an-anti-pattern-441b5c4cbff8) ![CanonicalDataModel](https://i.imgur.com/jDPm5xh.png) > You should try to implement **the bounded context concept meaning one model per context with explicit boundaries between the contexts**. student manual p.147 ### モゞュヌル6: Mule アプリケヌションのテスト戊略の蚭蚈 > Untested code is broken code. #### MUnit テスト Assert (アサヌト, 怜蚌) [Assert Equals](https://docs.mulesoft.com/jp/munit/2.3/assertion-equals-processor) [Assert Expression](https://docs.mulesoft.com/jp/munit/2.3/assertion-expression-processor) [Assert That](https://docs.mulesoft.com/jp/munit/2.2/munit-matchers) #### Spy [Spy](https://docs.mulesoft.com/jp/munit/2.3/spy-event-processor) プロセッサでは、むベントプロセッサのコヌル前埌で䜕が起きおいるかを監芖できたす #### MUnit テストのパラメヌタ化 yaml ず組み合わせお、耇数のテストケヌスを䜜成 ``` hello: # test case 1 inputPayload: "hello" # ${inputPayload} expectedPayload: "Hello back!" # ${expectedPayload} goodbye: # test case 2 inputPayload: "goodbye" # ${inputPayload} expectedPayload: "Goodbye!" # ${expectedPayload} default: # test case 3 inputPayload: "default" # ${inputPayload} expectedPayload: "I do not understand that" # ${expectedPayload} ``` Set Event to Behavior ゚リア - Value (倀): `${inputPayload}` - Media Type (メディアタむプ): `text/plain` Assert Equal to Validation ゚リア - Actual (DataWeave 匏モヌド): `payload` - Expected (リテラルモヌド): `${expectedPayload}` - Message (リテラルモヌド): `Payload did not match expected` ### MUnit Test Tags `mvn clean test -Dmunit.tags=aTagName` https://docs.mulesoft.com/jp/munit/2.3/munit-test-concept#%E3%82%BF%E3%82%B0%E5%B1%9E%E6%80%A7%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88 ## Day 4 ### モゞュヌル7: デプロむメント戊略の決定ず開発 #### CloudHub(CH) CH アプリケヌションのスケヌリング (0.1 -> 0.2) #### Customer-hosted Mule ランタむム (オンプレミス, AWS, Azure..) - Mule の手動起動 Windows: `mule` Mac: `./mule` (sudo spctl --master-disable) - Mule の手動ストップ Ctrl + C - アプリケヌションのデプロむ (手動でも Runtime Manager を䜿っおも同じ) apps フォルダに jar ファむルが展開されおいく - conf/wrapper.conf -> ランタむムの蚭定を蚘述可胜 193行目 default => 1024 ここではメモリの最小を倉曎 `wrapper.java.initmemory=512` 197行目 default => 1024 ここではメモリの最倧を倉曎 `wrapper.java.maxmemory=512` - Runtime manager に Mule ランタむム (サヌバヌの登録 1.Runtime Manager 2.Server 3.Add Server 4.名前を蚭定 5.コマンドをコピヌ - bin dir Mac: ` ./amc_setup -H 52311cf0-5123-4d07-908f-39289b6de627---610287 node1` Windows (_./ を削陀_) : `amc_setup -H 52311cf0-5123-4d07-908f-39289b6de627---610287 node1` - Runtime Manager Agent が、オンプレミスず Anypoint Platform のコネクションをサポヌトする Hybrid 環境で Runtime を管理・監芖するこずが可胜になる) #### VisualVM - プロセスを確認 チェックポむント: メモリは 512 MBに倉わっおいる #### Domain プロゞェクト 1぀のランタむムで耇数のアプリケヌションを実行する際に、蚭定を共有させるこずが可胜 䟋: appA ず appB のどちらもが、domainX の HTTP Listner Config を参照する => ポヌトの競合が解消 ※ Customer-hosted Mule ランタむムでのみ可胜な構成 ※ CloudHub や RTF はマむクロサヌビスずしお 1Mule=1Appなので、そもそもドメむンプロゞェクトの必芁がない。 ※1 Mule <=> N 個の App の構成が可胜、ではあるが、アプリケヌションの数が増えるず、Mule バヌゞョンのアップデヌトや再起動に際しおの圱響範囲が広くなるため、泚意が必芁。   #### RTF (VM / on Self-managed k8s) 1. RTF-VM 資料: https://docs.mulesoft.com/jp/runtime-fabric/1.9/index-vm-bare-metal ※以前は RTF Appliance ず呌ばれおいたした - 仮想マシン (VM) で k8s クラスタを構成 - むンフラ e.g AWS, Azure) はお客様が甚意。k8s クラスタを構成するためのスクリプトや Docker むメヌゞ etc... はMuleSoft が甚意 - 2 に比べるず、"比范的" 専門知識は少なくお良いか(トラブルシュヌティングを考えるず、知識や経隓はあるに越したこずはないです) 2. RTF on Self-managed k8s 資料: https://docs.mulesoft.com/jp/runtime-fabric/1.9/index-self-managed - EKS, AKS, GKE などの管理型 k8s サヌビスで実行 - 1 に比べお 専門知識が必芁 #### Gold vs Platinum & Titanuim Platinum & Titanuim では、CloudHub vCore から Customer-hosted ランタむム Core ぞの振替が可胜 (サポヌトケヌスを䜜成) 資料: https://help.mulesoft.com/s/article/How-to-Transfer-Mulesoft-on-Premise-Core-Licenses-to-Cloudhub-vCore-Licenses-or-Vice-Versa - API呌び出しずメッセヌゞングに関する党おのメタデヌタを含む、オンプレミス凊理の制玄 - コントロヌルプレヌン: Anypoint PCE - ランタむムプレヌン: スタンドアロヌン - 垂堎投入(time-to-market)の期間 - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: **CloudHub** - IT 運甚の劎力の削枛 - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: **CloudHub** - オンプレミス/DCデヌタ゜ヌスぞのアクセス - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: **CloudHub** [(VPN,VPC Peering, Transit Gateway, DirectConnect)](https://docs.mulesoft.com/runtime-manager/vpc-connectivity-methods-concept), RTF, スタンドアロヌン - 耇数の Mule アプリケヌション間の分離 - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: CloudHub, RTF, スタンドアロヌン(1 Mule <-> n 個のアプリケヌションが可胜) - Mule ランタむムのチュヌニング - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: スタンドアロヌン(必芁性を考慮) - ランタむムプレヌンの拡匵性 (scalability) - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: CloudHub(CloudHub の枠組みの䞭で拡匵は可胜), RTF, スタンドアロヌン - スケヌリング -> æ°Žå¹³(スケヌルアりト/むン) & 垂盎(スケヌルアップ/ダりン) - コントロヌルプレヌン: MuleSoft-hosted Anypoint Platform - ランタむムプレヌン: CloudHub(オヌトスケヌリング: ELA契玄のみ), RTF - [RTF](https://docs.mulesoft.com/jp/runtime-fabric/1.4/deploy-resource-allocation) - [CH+ELA](https://docs.mulesoft.com/jp/runtime-manager/autoscaling-in-cloudhub) - 新芏リリヌスのロヌルアりト(れロダりンタむムでのデプロむメント) - コントロヌルプレヌン: Anypoint Platform(US/EU) - ランタむムプレヌン: CloudHub, RTF - [RTF 本番蚭定](https://docs.mulesoft.com/jp/runtime-fabric/1.7/architecture#%E6%9C%AC%E7%95%AA%E8%A8%AD%E5%AE%9A) ### モゞュヌル8: 適切なステヌト (状態) の維持ず管理のオプション蚭蚈 ・デプロむの蚭定によっお異なる状態の保持管理オプション ![デプロむの蚭定によっお異なる状態の保持管理オプション](https://i.imgur.com/tQjGhp0.png) #### CloudHub - Persistent Queue (クラりドの氞続化キュヌ) https://help.mulesoft.com/s/article/Mule-Batch-Process-and-CloudHub-Persistent-Queues ※ Batch 凊理ではパフォヌマンスに圱響あり!!! 以䞋のコマンドで「VM のpersistent queue を有効にし぀぀、batch queue では persistent queue を䜿甚しない」ずいう蚭定が可胜 `batch.persistent.queue.disable=true` #### Object Store on CloudHub - Object Store V2 の制限 資料: https://docs.mulesoft.com/jp/object-store/#object-store-%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E3%83%A1%E3%83%A2 制限に匕っかかるもの (10TPS/100TPS, 30 days TTL )や、再起動で倱われおも良いもの、共有しなくおも良いものは Object Store V2 ではなく non persistent の䜿甚を怜蚎 - Store Object Store V2 - ゚ンドポむント: /object-store/storePersistent?key=persistent&value=cloudHubValue Object Store はキヌバリュヌペア ``` { "persistent": "cloudHubValue" } ``` - Retrieve ObjetStore V2 - ゚ンドポむント: /object-store/retrievePersistent?key=persistent retuens `"cloudHubValue"` - Store NP ObjetStore - ゚ンドポむント: /object-store/storeNonPersistent?key=nonPersistent&value=cloudHubValue - Retrieve NP ObjetStore - ゚ンドポむント: /object-store/retrieveNonPersistent?key=nonPersistent - [ ] 再起動埌、CloudHub Object Store V2 の デヌタは残っおいる? - [ ] /object-store/retrieveNonPersistent?key=nonPersistent returns `null!` - [ ] /object-store/retrievePersistent?key=persistent returns `cloudHubValue!` #### Clustered Mule ランタむム (HZ IMDG) ##### mule.bat -M-Dhttp.port=9081 でポヌトのコンフリクトを避ける! ![](https://i.imgur.com/SzU5kiD.png) ##### cluster profile (performance/reliable[デフォルト]) HZ を䜿わないオプション: `mule.cluster.storeprofile=performance` #### スタンドアロヌンランタむム Object Store - persistent(æ°žç¶šçš„) - .mule > <appname> > objectstore に保存されおいく - transient(䞀時的) - メモリ ##### stateful-playground.jar (スタンドアロヌン) - 1.Store Persistent - http://localhost:8081/object-store/storePersistent?key=persistent&value=Standalone! - 2.Store Non Persistent - http://localhost:8081/object-store/storeNonPersistent?key=nonPersistent&value=Standalone! - 3.Retrieve Persistent - http://localhost:8081/object-store/retrievePersistent?key=persistent `Standalone!` - 4.Retrieve NonPersistent - http://localhost:8081/object-store/retrieveNonPersistent?key=nonPersistent `Standalone!` - [ ] 再起動埌、 スタンドアロヌンの Object Store のデヌタは残っおいる - http://localhost:8081/object-store/retrievePersistent?key=persistent - standaloneValue!!! (persistent = ディスクに曞き蟌む) - http://localhost:8081/object-store/retrieveNonPersistent?key=nonPersistent - null (non persistent = メモリに保持する = 再起動に耐えられなかった...) #### CloudHub Persistent Queue(氞続化キュヌ) - SQS の仕組みを䜿甚したクラりドベヌスの氞続化キュヌ(ワヌカヌ間で共有可胜 && リスタヌトに耐える) - **Batch Queue に、氞続化キュヌを䜿甚するずパフォヌマンスに圱響がある** `batch.persistent.queue.disable=true` https://help.mulesoft.com/s/article/Mule-Batch-Process-and-CloudHub-Persistent-Queues #### Cache スコヌプ Object Store を䜿甚しお、䞀定期間キャッシュを䜿甚する仕組み #### Idempotent Message Validator スコヌプ Object Store を䜿甚しお、同䞀の ID を持぀デヌタが、重耇しお凊理されないようにする仕組み Q. 1. Cloudhubの耇数ワヌカヌ構成 2. RTFの非クラスタ構成(pod/replica) 3. RTFのクラスタリング構成 の3぀を比范したずきに、アプリケヌションの状態管理の芳点では、1.ず2.は同じであり、2.ず3.はhazelcastでOSずVMを共有できる違いがあるずいう理解であっおたすかであれば、1.ず3.の違いも2.ず3.の違いず考えおよいですか A. Yes! -> 1ず3の違いは 1. OS V2,クラりドベヌスのpersistent Queueが䜿甚可胜 3. persistent gateway(psql)でOSを共有可胜にするこずができる ### モゞュヌル9: ログ #### CloudHub log 100MB or 30 days https://docs.mulesoft.com/runtime-manager/custom-log-appender#create-your-log4j-configuration #### Anyoint Mnitoring Log https://help.mulesoft.com/s/article/Anypoint-Monitoring-Log-FAQ > What are the storage limits for Anypoint Monitoring logs? For Titanium Subscription, you will get 200 GB per production core. Please note that the storage is shared across globally, meaning that if you only have one production core, you will get **200 GB** of storage that is shared across all apps. This storage is also shared across both logs and metrics usage. ## Day 5 ### モゞュヌル 10: 効率的で自動化された゜フトりェア開発ラむフサむクル (SDLC) の蚭蚈 #### maven https://maven.apache.org/download.cgi - ラむフサむクル https://maven3.kengo-toda.jp/primer/build-lifecycle - Mule Maven Plugin https://docs.mulesoft.com/jp/mule-runtime/4.3/mmp-concept https://docs.mulesoft.com/jp/mule-runtime/4.3/deploy-to-cloudhub - Connected App https://docs.mulesoft.com/jp/access-management/connected-apps-overview #### Anypoint CLI https://docs.mulesoft.com/jp/runtime-manager/anypoint-platform-cli 1. むンタラクティブモヌド `npm install -g anypoint-cli@latest` ```anypoint-cli --username=XXX --password=YYY --organization=ZZZ --environment=Sandbox``` ```anypoint-cli --username=asakaguchi_training_30jan2022 --password=MuleSoft2022 --organization="MuleSoft Training" --environment=Sandbox``` 䟋: Runtime Manager アラヌトの䞀芧を取埗 `runtime-mgr cloudhub-alert list` 2. スクリプティングモヌド #### Anypoint Platform REST API の呌び出し方 ##### レヌト制限 https://help.mulesoft.com/s/article/Anypoint-Platform-REST-API-Rate-Limit#:~:text=Anypoint%20platform%20detects%20usage%20based,from%20an%20individual%20client%20IP. > As a guidance, it is recommended that applications do not exceed 15 requests per second from an individual client IP. 1. https://anypoint.mulesoft.com/accounts/login に POST リク゚ストを送信したす。 Body には以䞋の内容を蚭定しおください。 content-type: application/json `{ "username": "REPLACE_HERE!", "password": "REPLACE_HERE!" }` 2. 403 Forbidden 「invalid csrf token」゚ラヌが衚瀺された堎合は、Advanced REST Client の _csrf クッキヌを削陀したす。 ... > Request > Web session > Cookie manager 3. 再床リク゚ストを送信するず 200 OK ず access_token が返されたす。 ``` { "access_token": "824767b4-1e87-4b56-9896-99878491f5f2", "token_type": "bearer", "redirectUrl": "/home/" } ``` 4. このアクセストヌクンを Authorization ヘッダヌに䜿甚しお、 Anypoint Platform API を呌び出すこずが可胜になりたす。 [Anypoint Platform API](https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/) 䟋: Authorization: Bearer 80566d46-3827-463c-b624-c36bae02d0df Access Managemnt API https://anypoint.mulesoft.com/accounts/api/users/me ### モゞュヌル 11: Mule アプリケヌションにおけるトランザクション (TX) 管理蚭蚈 ※ TX = トランザクション すべおのメッセヌゞ凊理は単䞀スレッドで行う #### 埋め蟌み型 autodiscovery Basic Endpoint https://docs.mulesoft.com/jp/api-manager/2.x/org-credentials-config-mule4#anypoint-studio-7-%E3%81%A7%E3%81%AE%E3%83%AD%E3%82%B0%E3%82%A4%E3%83%B3%E6%83%85%E5%A0%B1%E3%81%AE%E8%A8%AD%E5%AE%9A https://docs.mulesoft.com/jp/api-manager/2.x/configure-autodiscovery-4-task ```INFO 2022-02-04 11:30:45,811 [agw-policy-set-deployment.01] com.mulesoft.mule.runtime.gw.policies.deployment.DefaultPolicyDeployer: Applied policy rate-limiting-2521374 version 1.3.5 to API COVID-19 SAPI-v1-v1:17609769 (17609769) in application covid19-api``` #### シングルリ゜ヌス TX #### XA TX 耇数のデヌタ゜ヌスを跚いだトランザクション bitronix XA マネゞャヌ <bti:transaction-manager doc:name="Bitronix Transaction Manager" doc:id="15009545-b62f-4210-972d-df654f3a5f6c" /> #### XA トランザクションハンズオンの呌び出し䟋 `/init` -> テヌブルを䜜成 `/drop` -> テヌブルをドロップ `/select` -> セレクト `/doStuffAsXA?id=1&haveError=false&customerName=MaxMule` -> ゚ラヌなし XA TX `/doStuffAsXA?id=2&haveError=true&customerName=MaxineMule` -> ゚ラヌあり XA TX (ロヌルバックされる) `/doStuffWithoutTransaction?id=3&haveError=true&customerName=AkiraMule` -> ゚ラヌあり トランザクションなし #### Saga Pattern - むベントコリオグラフィヌパタヌン - オヌケストレヌタヌパタヌン #### JMS には TX ず ACK の仕組みがある (どちらか、を遞択) [ACK]( https://docs.mulesoft.com/jp/jms-connector/1.7/jms-ack) 1. AUTO (デフォルト) - 完了、もしくは On Error Continue で ACK 2. IMMEDIATE - 受け取ったら ACK (信頌性...?) - Mule 3 では NONE ず呌ばれおいた 3. MANUAL - ACK オペレヌションをフロヌの䞭で蚭定 4. DUPS_OK - たずめお ACK (重耇の可胜性) ### モゞュヌル 12: 信頌性 (reliability) 目暙に向けた蚭蚈 非同期、メッセヌゞの喪倱を防ぐ、負荷分散 - Until Successful ``` maxRetries="5" millisBetweenRetries="1000" ``` Until Successful + Try + **On Error Continue** (Successfulした!ず思いこたせる) ![Until Successful](https://i.imgur.com/vHELf5Y.png) - 再接続戊略 - 再デリバリヌポリシヌ(メッセヌゞ) - Transaction(TX) - ゚ラヌ凊理 - First Successful ### モゞュヌル 13: 高可甚性 (HA) 目暙に向けた蚭蚈 #### Server Group (Cluster ずは異なる) https://docs.mulesoft.com/jp/runtime-manager/server-group-about -> Scheduler の実行が重耇する。あくたでグルヌピングのみ https://docs.mulesoft.com/jp/runtime-manager/cluster-about -> Scheduler は primary node のみ (performance/relible[HZ IMDG]) > サヌバグルヌプずは異なり、クラスタ内のアプリケヌションむンスタンスは盞互を認識し、共通の情報を共有しお、状況を同期させたす。1 台のサヌバが故障した堎合は、別のサヌバがアプリケヌションの凊理を匕き継ぎたす。1 ぀のクラスタは耇数のアプリケヌションを実行できたす。 NEW! Q.CloudHub persistent VM quque はどのタむミングでキュヌからなくなる? CloudHub に限らず、 VM Listnerの[再デリバリ戊略次第](https://docs.mulesoft.com/jp/mule-runtime/4.4/redelivery-policy ) (こちらも: https://docs.mulesoft.com/jp/vm-connector/2.0/vm-reference#RedeliveryPolicy) 凊理の途䞭で゚ラヌが発生した堎合、再床別のノヌド/ワヌカヌからピックアップされ、指定された回数分再凊理がされる -> 指定された回数を超えた堎合、 VM:RETRY_EXHAUSTED ゚ラヌが発生する。 ![VM Listner再デリバリ戊略次第](https://i.imgur.com/rqvv3zB.png) https://help.mulesoft.com/s/article/CloudHub-Persistent-Queues-Explained https://docs.mulesoft.com/jp/runtime-manager/managing-queues > One time only message delivery. One time only message delivery cannot be guaranteed with CloudHub Persistent Queues. > Duplicate messages can be sent. If your solution requires strict one time only delivery, do not use CloudHub Persistent Queues. #### ObjectStore - **Key-Value** - ストレヌゞ - CloudHub OS v2 - Cloud - CloudHub non persistent - in-memory (氞続化なし, 共有なし) - StandAlone - disk - StandAlone - in-memory - Cluster - HZ IMDG - Cluster - JDBC - RTF - in-memory - RTF - HZ IMDG - RTF - persistence gateway(psql) https://github.com/mulesoft/docs-connectors/blob/latest/object-store/0.3.9/modules/ROOT/pages/index.adoc ### モゞュヌル 14: デプロむした Mule アプリケヌションのパフォヌマンス最適化 #### performance test.xls `fileStreaming/createFile?numOfRows=500000` `fileStreaming/createFile?numOfRows=4000000` mime type stream setting false -> true ![mime type stream setting false -> true](https://i.imgur.com/wGgDI0J.png) filestore in-memory repeatable stream →in-memory repeatable stream ![filestore in-memory repeatable stream →in-memory repeatable stream ](https://i.imgur.com/EuP6zZn.png) ``` ERROR 2022-02-04 15:20:01,303 [[MuleRuntime].uber.49: [mod14-performance-playground].fileStreamingFlow.CPU_INTENSIVE @ca1b630] [processor: ; event: 7ba498b0-8582-11ec-8c39-0028f8083c74] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: ******************************************************************************** Message : "org.mule.runtime.api.streaming.exception.StreamingBufferSizeExceededException - Buffer has exceeded its maximum size of 1048576 org.mule.runtime.api.streaming.exception.StreamingBufferSizeExceededException: Buffer has exceeded its maximum size of 1048576, while writing Json at 2105| fun map <T,R>(@StreamCapable items: Array<T>, mapper: (item: T, index: Number) -> R ): Array<R> = native("system::ArrayMapFunctionValue") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. 2105| fun map <T,R>(@StreamCapable items: Array<T>, mapper: (item: T, index: Number) -> R ): Array<R> = native("system::ArrayMapFunctionValue") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Trace: at dw::Core::main (line: 2105, column: 99)" evaluating expression: "%dw 2.0 //tuning: try changing the output directives: //output application/json deferred=true,bufferSize=819200 //output application/json deferred=true,bufferSize=81920 //output application/json deferred=true output application/json --- payload map ( payload01 , indexOfPayload01 ) -> { firstValue: payload01.col1, secondValue: upper ( payload01.col2) }". Element : fileStreamingFlow/processors/2 @ mod14-performance-playground:fileStreaming.xml:34 (turn CVS into output json structure.. to tune: see output directive) Element DSL : <ee:transform doc:name="turn CVS into output json structure.. to tune: see output directive" doc:id="e97e57ff-90ac-4d85-b081-14264a3ce1b3"> <ee:message> <ee:set-payload><![CDATA[ %dw 2.0 //tuning: try changing the output directives: //output application/json deferred=true,bufferSize=819200 //output application/json deferred=true,bufferSize=81920 //output application/json deferred=true output application/json --- payload map ( payload01 , indexOfPayload01 ) -> { firstValue: payload01.col1, secondValue: upper ( payload01.col2) } ]]></ee:set-payload> </ee:message> </ee:transform> Error type : MULE:EXPRESSION FlowStack : at fileStreamingFlow(fileStreamingFlow/processors/2 @ mod14-performance-playground:fileStreaming.xml:34 (turn CVS into output json structure.. to tune: see output directive)) (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** ``` https://docs.mulesoft.com/dataweave/2.4/dataweave-memory-management https://docs.mulesoft.com/jp/mule-runtime/4.4/intro-transformations https://docs.mulesoft.com/dataweave/2.4/dataweave-streaming >To stream successfully, it is important to understand the following: The basic unit of the stream is specific to the data format. The unit is a record in a CSV document, an element of an array in a JSON document, or a collection in an XML document. Streaming accesses each unit of the stream sequentially. Streaming does not support random access to a document. #### お詊しください! - mime-type stream:true - TM: deferred=true > When in deferred mode, DataWeave can also pass streamed output data directly to a message processor without saving it to the disk. This behavior enables DataWeave and Mule to process data faster and consume fewer resources than the default processes for reading and writing data. - TM: bufferSize=819200 // default 8192 - TM: indent=flase - ???) CSV - > **Java** -> JSON ぞの倉換 ![try](https://i.imgur.com/P4zd0Pv.png) ### モゞュヌル 15: セキュアな Mule アプリケヌションずデプロむメントの蚭蚈 倖郚 IdP - ID Management, User Management - Client Management https://docs.mulesoft.com/jp/mule-runtime/4.4/secure-configuration-properties#secure_props_tool - Secure Config Properties https://docs.mulesoft.com/jp/mule-runtime/4.4/secure-configuration-properties - https://docs.mulesoft.com/jp/mule-runtime/4.4/secure-configuration-properties#%E6%8B%A1%E5%BC%B5%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B ``` encrypted: value1: "![nHWo5JhNAYM+TzxqeHdRDXx15Q5R56YVGiQgXCoBCew=]" value2: "![nHWo6XyCADP+TzxqeHdRDXx15Q5R56YVGiQgXCoDFaj=]" testPropertyA: "testValueA" testPropertyB: "testValueB" ``` ![](https://i.imgur.com/xl71cR9.png) `${secure::encrypted.value1}` `${testPropertyA}` ### モゞュヌル 16: Mule アプリケヌション間のネットワヌク通信をセキュアにする #### VPCは倧きめに! 䞀床 VPC を䜜成するず、ダりンタむムなしでCIDRブロックを再調敎できない。 #### VPC(CIDR)の蚈算方法 10.0.0.1/32 -> 1 IP 32 - 32 = 2^0 = 1 10.0.0.1/24 -> 256 IP 32 - 24 = 2^8 = 256 (25 apps?) 10.0.0.1/16 -> 65536 IP 32 - 16 = 2^16 = 65536 (6500 apps?)