Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MuleSoft mock com set payload
Search
Alex teles
January 09, 2017
Education
0
44
MuleSoft mock com set payload
MuleSoft mock com set payload
Alex teles
January 09, 2017
Tweet
Share
More Decks by Alex teles
See All by Alex teles
Mulesoft configurando conexão com banco AS400 DB2
alexteles10
0
88
Chamando um flow de dentro do Transform Message
alexteles10
0
71
MuleSoft Juntando duas ou mais Listas ordenadas
alexteles10
0
67
MuleSoft Como mockar resultado com transform mensager
alexteles10
0
39
Como excluir o conector do facebook Do anyponit
alexteles10
0
66
Baixando conectores que não são nativos
alexteles10
0
57
Editor do Anypoint
alexteles10
0
41
MuleSoft Como fazer um when dentro de um when
alexteles10
0
45
MuleSoft Property configuração
alexteles10
0
56
Other Decks in Education
See All in Education
JPCERTから始まる草の根活動~セキュリティ文化醸成のためのアクション~
masakiokuda
0
170
Padlet opetuksessa
matleenalaakso
4
14k
SkimaTalk Teacher Guidelines
skimatalk
0
780k
Open Source Summit Japan 2025のボランティアをしませんか
kujiraitakahiro
0
510
新卒研修に仕掛ける 学びのサイクル / Implementing Learning Cycles in New Graduate Training
takashi_toyosaki
1
130
OpenAI Education Forum 資料「教育と生成AI ~事例から見えるこれからの活用~」
luiyoshida
2
750
2025年度春学期 統計学 第2回 統計資料の収集と読み方(講義前配付用) (2025. 4. 17)
akiraasano
PRO
0
130
Sponsor the Conference | VizChitra 2025
vizchitra
0
420
ThingLink
matleenalaakso
28
4.1k
横浜翠嵐高校 職業講話 / Talk for YOKOHAMA SUIRAN 2024
mura_mi
0
210
バックオフィス組織にも「チームトポロジー」の考えが使えるかもしれない!!
masakiokuda
0
100
OpenRobomaster 中国のロボットコンテスト 日本連携の可能性
takasumasakazu
0
430
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
329
21k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
KATA
mclloyd
29
14k
Embracing the Ebb and Flow
colly
85
4.7k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
910
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
RailsConf 2023
tenderlove
30
1.1k
Side Projects
sachag
454
42k
Into the Great Unknown - MozCon
thekraken
39
1.8k
Transcript
MuleSoft 2017
Hoje vamos falar de mock dados usando o Set
payload
Vamos criar um fluxo com da seguinte forma (Poll, set
Payload, Transform Message, log)
Mude a execução do Poll para minutos para não executa
a cada um segundo
Nosso transform espera receber uma lista de json com (Nome,
Descricao e Valor) então preciso passa essa estrutura com valores para testar.
Estrutura json [ { "Nome":"pao", "Descricao":"pao de queijo", "Valor":"1"
}, { "Nome":"queijo", "Descricao":"queijo coalho", "Valor":"2" } ]
No Set Payload no quadro value você tem que preenche
com o json semelhante com a esperada
Json setado no set payload e type MIME e Encoging
Rodando o projeto em modo Debug com break no Set
payload Payload vázio
Depois do set Payload o valor do set payload foi
atribuído ao payload
Resultado depois do transform uma lista conforme a saída setado
no transform
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring- beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> <flow name="mock-set-payloadFlow"> <poll doc:name="Poll"> <fixed-frequency-scheduler frequency="1000" timeUnit="MINUTES"/> <logger message="====Start=====" level="INFO" doc:name="Logger"/> </poll> <set-payload value="[ { "Nome":"pao", "Descricao":"pao de queijo", "Valor":"1" },
{ "Nome":"queijo", "Descricao":"queijo coalho", "Valor":"2"
} ]" encoding="UTF-8" mimeType="application/json" doc:name="Set Payload"/> <dw:transform-message metadata:id="a1c6eb81-1b6a-4655-b17f-2ee3d5afb0e0" doc:name="Transform Message"> <dw:input-payload doc:sample="input.json" mimeType="application/json"/> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- payload map ((payload01 , indexOfPayload01) -> { name: payload01.Nome, description: payload01.Descricao, value: payload01.Valor })]]></dw:set-payload> </dw:transform-message> <logger message="=====resultado======#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/> </flow> </mule>
FIM