Skip to content

Commit

Permalink
Merge pull request #48 from mulesoft-catalyst/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DavoCoder authored Sep 11, 2020
2 parents a179214 + fd7fd13 commit b35ad05
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.mulesoft</groupId>
<artifactId>metrics-framework</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>
<packaging>mule-application</packaging>

<name>metrics-framework</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/

<flow name="api-call-analytics-events-flow" doc:id="cb45e4dc-7fd3-476d-aff3-7c0a30556088" maxConcurrency="${anypoint.platform.apis.analytics.maxConcurrency}">
<logger level="DEBUG" doc:name="Logger" doc:id="c04d063d-9f26-41c8-9f2c-efd64bc5a457" message="Calling Analytics - Events" />
<http:request method="GET" doc:name="Get Events Request" doc:id="ea3a4010-08c1-44e9-b9d4-a82201dbb162" config-ref="HTTP_Request_configuration"
path="${anypoint.platform.apis.analytics.events.path}">
<flow-ref doc:name="Get Events Flow Reference" doc:id="61c06a57-895a-4101-8404-a9a3c0d8ae69" name="api-call-analytics-get-events-flow" />
<logger level="DEBUG" doc:name="Logger" doc:id="44625425-13b2-42b6-9886-1bbbe2de07fb" message='#["Analytics - Events, Response Status Code:" ++ attributes.statusCode]' />
</flow>
<flow name="api-call-analytics-get-events-flow" doc:id="7bbe4fb0-475f-44ac-821f-21bccc72768a" >
<http:request method="GET" doc:name="Get Events Request" doc:id="ea3a4010-08c1-44e9-b9d4-a82201dbb162" config-ref="HTTP_Request_configuration" path="${anypoint.platform.apis.analytics.events.path}">
<http:headers><![CDATA[#[output application/java
---
{
Expand All @@ -29,18 +32,41 @@ http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/
"format" : p('anypoint.platform.apis.analytics.events.format')
}]]]></http:query-params>
</http:request>
<logger level="DEBUG" doc:name="Logger" doc:id="44625425-13b2-42b6-9886-1bbbe2de07fb" message='#["Analytics - Events, Response Status Code:" ++ attributes.statusCode]' />
<error-handler >
<on-error-continue enableNotifications="false" logException="false" doc:name="On HTTP 429 Error" doc:id="15d90329-25e5-4fcc-b2f9-931da8f02b58" type="HTTP:TIMEOUT,HTTP:INTERNAL_SERVER_ERROR,HTTP:TOO_MANY_REQUESTS">
<set-variable value="#[vars.pendingRetries default (p('anypoint.platform.apis.analytics.retries.max') as Number)]" doc:name="Set pendingRetries" doc:id="5c1f3d03-a954-471c-969d-969b877a48c5" variableName="pendingRetries"/>
<choice doc:name="Choice" doc:id="48026431-9648-4735-9620-263244523189" >
<when expression="#[vars.pendingRetries &gt; 0]">
<ee:transform doc:name="Wait" doc:id="2a5ba013-0fbe-4364-a0dd-28c983fbdbea">
<ee:message>
<ee:set-payload><![CDATA[payload dw::Runtime::wait (p('anypoint.platform.apis.analytics.retries.wait') as Number)]]></ee:set-payload>
</ee:message>
<ee:variables >
<ee:set-variable variableName="pendingRetries" ><![CDATA[vars.pendingRetries - 1]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="Get Events Flow Reference" doc:id="1de62a92-b7d7-4752-a3d7-c8e595efd12e" name="api-call-analytics-get-events-flow" />
</when>
<otherwise >
<raise-error doc:name="Raise error" doc:id="dcc4040f-12f0-4c6f-9644-32cf13a4da84" type="APP:RETRIES_EXHAUSTED" description="Exchange - Get Assets - Retries were exhausted"/>
</otherwise>
</choice>
<remove-variable doc:name="Remove pendingRetries" doc:id="1fa7fcd9-007b-4e01-a7b1-67314c5ef904" variableName="pendingRetries"/>
</on-error-continue>
</error-handler>
</flow>

<flow name="api-call-analytics-query-flow" doc:id="9b3e1b21-cf25-4acf-b543-6539891fa08c" maxConcurrency="${anypoint.platform.apis.analytics.maxConcurrency}">
<logger level="DEBUG" doc:name="Logger" doc:id="aeda6f47-6889-471c-9163-296ed1791eab" message="Calling Analytics - Query" />
<ee:transform doc:name="Build Analytics Enriched Data Request" doc:id="62a96daa-7d08-4d34-8127-04165454dd3a">
<ee:message>
<ee:set-payload resource="dw/anypoint/analytics-query-request.dwl" />
</ee:message>
</ee:transform>
<http:request method="POST" doc:name="Get Analytics Enriched Data Request" doc:id="2021c5c3-4242-4cc9-8a29-bad19ce7af3d"
config-ref="HTTP_Request_configuration" path="${anypoint.platform.apis.analytics.query.path}" responseTimeout="${anypoint.platform.apis.analytics.query.timeout}">
<flow-ref doc:name="Get Enriched Data Flow Reference" doc:id="923a0942-3fa6-40c1-bac9-085a9f7d0da9" name="api-call-analytics-get-enriched-data-flow" />
<logger level="DEBUG" doc:name="Logger" doc:id="6b27bd5e-27be-4376-84da-31f328fc8b98" message='#["Analytics - Query, Response Status Code:" ++ attributes.statusCode]' />
</flow>
<flow name="api-call-analytics-get-enriched-data-flow" doc:id="b409a23e-16e0-4e29-bcc5-947d37a6f158" >
<http:request method="POST" doc:name="Get Analytics Enriched Data Request" doc:id="2021c5c3-4242-4cc9-8a29-bad19ce7af3d" config-ref="HTTP_Request_configuration" path="${anypoint.platform.apis.analytics.query.path}" responseTimeout="${anypoint.platform.apis.analytics.query.timeout}">
<http:headers><![CDATA[#[output application/java
---
{
Expand All @@ -53,8 +79,28 @@ http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/
"envId" : vars.environmentId
}]]]></http:uri-params>
</http:request>
<logger level="DEBUG" doc:name="Logger" doc:id="6b27bd5e-27be-4376-84da-31f328fc8b98" message='#["Analytics - Query, Response Status Code:" ++ attributes.statusCode]' />
<error-handler >
<on-error-continue enableNotifications="false" logException="false" doc:name="On HTTP 429 Error" doc:id="fb4af52a-c1f2-420c-abcc-d8e3332bafd0" type="HTTP:TIMEOUT,HTTP:INTERNAL_SERVER_ERROR,HTTP:TOO_MANY_REQUESTS">
<set-variable value="#[vars.pendingRetries default (p('anypoint.platform.apis.analytics.retries.max') as Number)]" doc:name="Set pendingRetries" doc:id="4a2895c6-ceeb-4e7f-9776-04eaa3cbb8ad" variableName="pendingRetries"/>
<choice doc:name="Choice" doc:id="04e65d5a-231a-4568-a4da-2481cfc326d8" >
<when expression="#[vars.pendingRetries &gt; 0]">
<ee:transform doc:name="Wait" doc:id="b9c78702-dceb-4b7a-a574-e1b2c2c31c45">
<ee:message>
<ee:set-payload><![CDATA[payload dw::Runtime::wait (p('anypoint.platform.apis.analytics.retries.wait') as Number)]]></ee:set-payload>
</ee:message>
<ee:variables >
<ee:set-variable variableName="pendingRetries" ><![CDATA[vars.pendingRetries - 1]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="Get Enriched Data Flow Reference" doc:id="f386de0d-4976-418b-9f8f-d73dc9f55140" name="api-call-analytics-get-enriched-data-flow" />
</when>
<otherwise >
<raise-error doc:name="Raise error" doc:id="7333d3d3-660d-4730-968e-b67db8de2d66" type="APP:RETRIES_EXHAUSTED" description="Exchange - Get Assets - Retries were exhausted"/>
</otherwise>
</choice>
<remove-variable doc:name="Remove pendingRetries" doc:id="2851f161-602e-405d-a21c-f36312465250" variableName="pendingRetries"/>
</on-error-continue>
</error-handler>
</flow>


</mule>
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/

<flow name="api-call-api-manager-api-policies-flow" doc:id="392b0852-86a0-4067-bab6-7b5f55855136" maxConcurrency="${anypoint.platform.apis.apiManager.maxConcurrency}">
<logger level="DEBUG" doc:name="Logger" doc:id="19b1b41d-e3f3-40bf-a39d-2fbdfc8e2738" message="Calling API Manager - API Policies" />
<http:request method="GET" doc:name="Get API Policies Request" doc:id="d5c85809-9166-498c-babc-e74cd8a8a886" config-ref="HTTP_Request_configuration"
path="${anypoint.platform.apis.apiManager.apiPolicies.path}">
<flow-ref doc:name="Get API Policies Flow Reference" doc:id="68f786bc-35e9-4cfd-82a0-2f381a69e1a9" name="api-call-api-manager-get-api-policies-flow"/>
<logger level="DEBUG" doc:name="Logger" doc:id="3099c073-7970-440a-8683-90ecfe96a6d5" message='#["API Manager - API Policies, Response Status Code:" ++ attributes.statusCode]' />
</flow>
<flow name="api-call-api-manager-get-api-policies-flow" doc:id="b713ffb3-75f8-4b8e-a235-727f9cedd21c" >
<http:request method="GET" doc:name="Get API Policies Request" doc:id="d5c85809-9166-498c-babc-e74cd8a8a886" config-ref="HTTP_Request_configuration" path="${anypoint.platform.apis.apiManager.apiPolicies.path}">
<http:headers><![CDATA[#[output application/java
---
{
Expand All @@ -41,17 +44,37 @@ http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/
"apiId" : vars.apiId,
"envId" : vars.environmentId
}]]]></http:uri-params>
<http:query-params ><![CDATA[#[output application/java
<http:query-params><![CDATA[#[output application/java
---
{
"includeProxyTemplate" : true,
"includeTlsContexts" : true,
"includeValidation" : true
}]]]></http:query-params>
</http:request>
<logger level="DEBUG" doc:name="Logger" doc:id="3099c073-7970-440a-8683-90ecfe96a6d5" message='#["API Manager - API Policies, Response Status Code:" ++ attributes.statusCode]' />
<error-handler >
<on-error-continue enableNotifications="false" logException="false" doc:name="On HTTP 429/500 Error" doc:id="3cba3d91-87a8-46d1-a51c-4fec21a6637b" type="HTTP:INTERNAL_SERVER_ERROR,HTTP:TOO_MANY_REQUESTS">
<set-variable value="#[vars.pendingRetries default (p('anypoint.platform.apis.apiManager.apiPolicies.retries.max') as Number)]" doc:name="Set pendingRetries" doc:id="9310a5c4-eebd-4316-b500-f40fd0c1c066" variableName="pendingRetries"/>
<choice doc:name="Choice" doc:id="e2f9d666-453c-47b6-b062-e8e51ff01310" >
<when expression="#[vars.pendingRetries &gt; 0]">
<ee:transform doc:name="Wait" doc:id="8aa782e9-31f7-4295-b75c-784320844a79">
<ee:message>
<ee:set-payload><![CDATA[payload dw::Runtime::wait (p('anypoint.platform.apis.apiManager.apiPolicies.retries.wait') as Number)]]></ee:set-payload>
</ee:message>
<ee:variables >
<ee:set-variable variableName="pendingRetries" ><![CDATA[vars.pendingRetries - 1]]></ee:set-variable>
</ee:variables>
</ee:transform>
<flow-ref doc:name="Get API Policies Flow Reference" doc:id="1fad8a3e-09f3-4768-a2b7-7147ea57cf12" name="api-call-api-manager-get-api-policies-flow" />
</when>
<otherwise >
<raise-error doc:name="Raise error" doc:id="f2b6fcb3-3368-4b57-8006-f1ffc1d69e39" type="APP:RETRIES_EXHAUSTED" description="Exchange - Get Assets - Retries were exhausted"/>
</otherwise>
</choice>
<remove-variable doc:name="Remove pendingRetries" doc:id="450af0cc-0853-4f53-b753-c0964fc7ab64" variableName="pendingRetries"/>
</on-error-continue>
</error-handler>
</flow>

<flow name="api-call-api-manager-automated-policies-flow" doc:id="42654c28-a89d-4de6-88ba-dc0fb72281a8" maxConcurrency="${anypoint.platform.apis.apiManager.maxConcurrency}">
<logger level="DEBUG" doc:name="Logger" doc:id="72a5e4e6-06fc-40d8-a9c8-b52535a58743" message="Calling API Manager - Automated Policies" />
<http:request method="GET" doc:name="Get Automated Policies Request" doc:id="12594095-06f6-4b7a-af6d-5b3150abe1af" config-ref="HTTP_Request_configuration"
Expand Down
Loading

0 comments on commit b35ad05

Please sign in to comment.