Skip to content

Instantly share code, notes, and snippets.

Mariano Gonzalez marianogonzalez

Block or report user

Report or block marianogonzalez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1933227
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ssh="http://www.mulesoft.org/schema/mule/sshmultiplexedconnector"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ssh http://www.mulesoft.org/schema/mule/sshmultiplexedconnector/1.0/mule-sshmultiplexedconnector.xsd">
View target.xml
<flow name="getStockInfo">
<http:listener path="stock" method="GET" config-ref="httpListener">
<http:response>
<http:body>
<![CDATA[
%dw 2.0
output application/json
---
{
"ticker": attributes.queryParams.ticker,
View persons.xml
<flow name="prersons">
<http:listener path="person" method="POST" config-ref="httpListener" />
<foreach collection="#[payload.persons]">
<choice>
<when expression="#[payload.age > 21"]>
<logger message="#['$(payload.name) is an adult']" />
</when>
<otherwise>
<logger message="#['$(payload.name) is a minor.']" />
</otherwise>
View persons.json
{
persons: [
{
name: "John Doe",
age: 35
},
{
name: "Jane Doe",
age: 32
},
View idempotent.xml
<idempotent-message-validator idExpression="#[payload]" valueExpression="#[payload]">
<os:private-object-store
entryTtl="20"
entryTtlUnit="MILLISECONDS"
maxEntries="20"
persistent="false"
expirationInterval="20"
expirationIntervalUnit="MILLISECONDS"/>
</idempotent-message-validator>
View sfdc.xml
<sfdc:config-with-oauth name="salesforce-oauth"
consumerKey="${salesforce.consumerKey}"
consumerSecret="${salesforce.consumerSecret}">
<sfdc:oauth-callback-config domain="localhost" localPort="8082"
remotePort="8082" path="callback" connector-ref="HTTP_HTTPS" />
<sfdc:oauth-store-config objectStore="tokensStore" />
</sfdc:config-with-oauth>
View global.xml
<os:object-store name="tokensStore"
entryTtl="1"
entryTtlUnit="HOURS"
maxEntries="100"
persistent="true"
expirationInterval="30"
expirationIntervalUnit="MINUTES" />
View retrieve-default2.xml
<os:retrieve key="state">
<os:default-value>
<![CDATA[#[
output application/json
---
{ "id": attributes.queryParams.id,
"timestamp": now(),
"name": payload.name
}
]]]>
View retrieve-default.xml
<os:retrieve key="timestamp">
<os:default-value>#[now()]</os:default-value>
</os:retrieve>
You can’t perform that action at this time.