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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Alex teles
January 09, 2017
Education
0
55
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
100
Chamando um flow de dentro do Transform Message
alexteles10
0
78
MuleSoft Juntando duas ou mais Listas ordenadas
alexteles10
0
72
MuleSoft Como mockar resultado com transform mensager
alexteles10
0
46
Como excluir o conector do facebook Do anyponit
alexteles10
0
71
Baixando conectores que não são nativos
alexteles10
0
61
Editor do Anypoint
alexteles10
0
45
MuleSoft Como fazer um when dentro de um when
alexteles10
0
60
MuleSoft Property configuração
alexteles10
0
60
Other Decks in Education
See All in Education
SJRC 2526
cbtlibrary
1
210
【dip】「なりたい自分」に近づくための、「自分と向き合う」小さな振り返り
dip_tech
PRO
0
250
20251119 如果是勇者欣美爾的話, 他會怎麼做? 東海資工
pichuang
1
180
Leveraging LLMs for student feedback in introductory data science courses (Stats Up AI)
minecr
1
230
Web Search and SEO - Lecture 10 - Web Technologies (1019888BNR)
signer
PRO
2
3.1k
Chapitre_2_-_Partie_3.pdf
bernhardsvt
0
180
JAPAN AI CUP Prediction Tutorial
upura
2
890
Introduction - Lecture 1 - Advanced Topics in Big Data (4023256FNR)
signer
PRO
2
2.2k
The World That Saved Me: A Story of Community and Gratitude
_hashimo2
4
530
GOBUSATA紹介
chankawa919
0
120
AIで日本はどう進化する? 〜キミが生きる2035年の地図〜
behomazn
0
120
1125
cbtlibrary
0
190
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
830
Docker and Python
trallard
47
3.8k
KATA
mclloyd
PRO
35
15k
Code Reviewing Like a Champion
maltzj
528
40k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Chasing Engaging Ingredients in Design
codingconduct
0
130
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
59
50k
Thoughts on Productivity
jonyablonski
75
5.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
110
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
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