Mulesoft,两个月考证准备,每天进步一点点!

目录

  • 常用网站
  • 社区论坛
  • 相关文档
    • DataWeave
    • Mule Expression Language Reference
  • 概述
  • 刷真题,查漏补缺
    • 20200318
    • 20200321
    • 20200323
    • 20200324
    • 20200329
    • 20200330
    • 20200331
    • 20200401
    • 20200402
    • 20200403
    • 20200404
    • 20200405
    • 20200406
    • 20200407
    • 20200411
    • 20200412
    • 20200413
    • 20200414
    • 20200415
    • 20200416
    • 20200417
    • 20200419
    • 20200421
    • 20200422
    • 20200423
    • 20200427
    • 20200430
    • 20200502
    • 20200503
    • 20200509
    • 20200511
    • 20200512
    • 20200514
    • 20200515
    • 20200518
    • 20200520
    • 20200521
    • 20200524
    • 20200526
    • 20200528

常用网站

  • Training and certification:
    https://training.mulesoft.com/

  • Course|MuleSoft.U Development Fundamentals (Mule 4):https://training.mulesoft.com/course/mulesoftu-fundamentals4

  • MuleSoft Documentation:
    https://docs.mulesoft.com/general/

社区论坛

Training forums:https://help.mulesoft.com/s/training-groups

相关文档

DataWeave

https://docs.mulesoft.com/mule-runtime/latest/dataweave-cookbook

Mule Expression Language Reference

https://docs.mulesoft.com/mule-runtime/3.9/mule-expression-language-reference

概述

MuleSoft Certified Developer - Level 1 (Mule 4)

DataWeave
DataWeave is the MuleSoft expression language for transforming data as it travels through a Mule application.

刷真题,查漏补缺

20200318

Mulesoft,两个月考证准备,每天进步一点点!_第1张图片
Mulesoft,两个月考证准备,每天进步一点点!_第2张图片
Database expression transforms the input to the output

第一种,是个对象数组

payload map ( payload01 , indexOfPayload01 ) -> {
	ID: payload01.ID,
	code: (payload01.code1 default "") ++ (payload01.code2 default ""),
	price: payload01.price default 0,
	departureDate: payload01.takeOffDate as String default "",
	origin: payload01.fromAirport default "",
	destination: payload01.toAirport default "",
	emptySeats: payload01.seatsAvailable default 0,
	plane: {
		"type": payload01.planeType default "",
		totalSeats: payload01.totalSeats default 0
	}
}

第二种,对象数组外面,包了items对象

items: payload.books map ((item, index) -> {
      category: "book",
      price: item.price as Number,
      id: index,
      properties: {
        title: item.title,
        author: item.author,
        year: item.year as Number
      }
   }
)
{
  "items": [
    {
      "category": "book",
      "price": 30.00,
      "id": 0,
      "properties": {
        "title": {
          "-lang": "en",
          "#text": "Everyday Italian"
        },
        "author": "Giada De Laurentiis",
        "year": 2005
      }
    },
    {
      "category": "book",
      "price": 39.95,
      "id": 3,
      "properties": {
        "title": {
          "-lang": "en",
          "#text": "Learning XML"
        },
        "author": "Erik T. Ray",
        "year": 2003
      }
    }
  ]
}

20200321

dataWeave Reference

lookup
lookup(flowName,payload,timeoutMillis)
lookup(String, Any, Number)
This function enables you to execute a flow within a Mule app and retrieve the resulting payload.
e.g.:Mule::lookup(‘flow2’, {test:'hello '})
Mulesoft,两个月考证准备,每天进步一点点!_第3张图片

core components

scatter-gather component
Each of these routes uses a separate thread to execute the event processors
所以是并行处理的。

20200323

Mule Event
A Mule Event is composed of these objects:
A Mule Message contains a message payload and its associated attributes.
Variables are Mule event metadata that you use in your flow.
Mulesoft,两个月考证准备,每天进步一点点!_第4张图片
Mule message
The Mule message is the data that passes through an application via one or more flows. It consists of two main parts:

  • The message header, which contains metadata about the message.
  • The message payload, which contains your business-specific data.
    payload-有效载荷,业务相关的数据。

Validators>Validations Module
The Validations module provides an easy out-of-the-box way to verify that the content of a message in your flow matches a given set of criteria.

20200324

RAML
The API needs to be updated using the company-wide standard for the Plan data type. The Object
data type has already been published in Anypoint Exchange with the global reference .
ACME/DataTypes/PlanDataType.raml.
What is a valid RAML specification that reuses the Plan data type?

Mulesoft,两个月考证准备,每天进步一点点!_第5张图片
API Designer>
Using !include
To modularize the API definition, RAML provides several mechanisms, one of which is the !include property. To keep the API definition concise, you can include external content, such as documentation, schemas, and frequently used patterns outside the definition itself. The parser interprets !include as if the content of the externally-hosted file or a URL were declared in-line.

API Manager>
Service Level Access (SLA)
API Proxy
Mulesoft,两个月考证准备,每天进步一点点!_第6张图片

20200329

DWL (DataWeave language)
Create Custom Modules and MappingsMulesoft,两个月考证准备,每天进步一点点!_第7张图片
Mulesoft,两个月考证准备,每天进步一点点!_第8张图片

20200330

Mulesoft,两个月考证准备,每天进步一点点!_第9张图片
详见0323,Mule event has variables and Mule message
Mulesoft,两个月考证准备,每天进步一点点!_第10张图片

20200331

Mulesoft,两个月考证准备,每天进步一点点!_第11张图片
Mulesoft,两个月考证准备,每天进步一点点!_第12张图片

20200401

Mulesoft,两个月考证准备,每天进步一点点!_第13张图片
Mulesoft,两个月考证准备,每天进步一点点!_第14张图片Mulesoft,两个月考证准备,每天进步一点点!_第15张图片
Batch Aggregator
You can use the batch aggregator scope to accumulate a subset of records from a batch step, and bulk upsert them to an external source or service.
For example, rather than upserting each lead (i.e., record) in a batch to Salesforce, you can configure a Batch Commit to accumulate, say, 200 records and then upsert all of them to Salesforce in one chunk.

:step name="Step2">
	:aggregator size="200">
     :create type="Lead" .../>
	:aggregator>
:step>

20200402

Mulesoft,两个月考证准备,每天进步一点点!_第16张图片

20200403

Logger Component
This Core component helps you monitor and debug your Mule application by logging important information such as error messages, status notifications, payloads, and so on. You can add a Logger anywhere in a flow, and you can configure it to log a string that you specify, the output of a DataWeave expression you write, or any combination of strings and expressions.

Keep in mind that the Logger is one of the only components that supports mixing Strings and expressions within a value. DataWeave String interpolation or concatenation within a single expression should be used elsewhere.

The configured messages are logged to the app’s log file, which is located in MULE_HOME/logs/.log if no custom log file path is specified in the log4j2.xml file.
In Studio, the logs show in the Console.

:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081"/>
-example-Flow">
  :listener config-ref="HTTP_Listener_Configuration" path="/"/>
  -payload value="Hello MuleSoft!"/>
  #[payload]" level="INFO"/>
>

Mulesoft,两个月考证准备,每天进步一点点!_第17张图片
Mulesoft,两个月考证准备,每天进步一点点!_第18张图片

20200404

Mulesoft,两个月考证准备,每天进步一点点!_第19张图片
Mulesoft,两个月考证准备,每天进步一点点!_第20张图片

20200405

还是建议在AnypointStudio运行一下试试!!!
Mulesoft,两个月考证准备,每天进步一点点!_第21张图片

20200406

Mulesoft,两个月考证准备,每天进步一点点!_第22张图片
Mulesoft,两个月考证准备,每天进步一点点!_第23张图片
Mulesoft,两个月考证准备,每天进步一点点!_第24张图片

20200407

Mulesoft,两个月考证准备,每天进步一点点!_第25张图片
Mulesoft,两个月考证准备,每天进步一点点!_第26张图片

20200411

Deploy Applications to CloudHub

>
  >org.mule.tools.maven>
  >mule-maven-plugin>
  >3.3.2>
  >true>
  >
    >
      >https://anypoint.mulesoft.com>
      >${app.runtime}>
      >${username}>
      >${password}>
      >${cloudhub.application.name}>
      >${environment}>
      >
        >value>
      >
    >
  >
>

CloudHub Deployment Reference
Top-Level element
If you need to set properties for the Mule application you are deploying, you can use the top-level element:

>
  >value>
>

For example:

>
  >8081>
>

Mulesoft,两个月考证准备,每天进步一点点!_第27张图片
Mulesoft,两个月考证准备,每天进步一点点!_第28张图片

20200412

Mulesoft,两个月考证准备,每天进步一点点!_第29张图片
Mulesoft,两个月考证准备,每天进步一点点!_第30张图片

20200413

同第9题,Create Custom Modules and Mappings
Mulesoft,两个月考证准备,每天进步一点点!_第31张图片
Mulesoft,两个月考证准备,每天进步一点点!_第32张图片

20200414

Mulesoft,两个月考证准备,每天进步一点点!_第33张图片
Mulesoft,两个月考证准备,每天进步一点点!_第34张图片
Mulesoft,两个月考证准备,每天进步一点点!_第35张图片

20200415

#[payload.year]

Mulesoft,两个月考证准备,每天进步一点点!_第36张图片

20200416

#[payload=='US']

Mulesoft,两个月考证准备,每天进步一点点!_第37张图片

20200417

Mulesoft,两个月考证准备,每天进步一点点!_第38张图片
Mulesoft,两个月考证准备,每天进步一点点!_第39张图片

20200419

同第3题,
lookup(flowName,payload,timeoutMillis)
Mulesoft,两个月考证准备,每天进步一点点!_第40张图片
Mulesoft,两个月考证准备,每天进步一点点!_第41张图片
No.37

%dw 2.0
var testXml = typeOf(payload)
var testJson = typeOf({test:'hello'})
var testStr = typeOf('a string')
var testArray = typeOf(['hello','world'])
var testNumber = typeOf(100)
output application/json
---

{
	testXml:testXml,
	testJson:testJson,
	testStr:testStr,
	testArray:testArray,
	testNumber:testNumber
}

Output如下:

{
  "testXml": "Object",
  "testJson": "Object",
  "testStr": "String",
  "testArray": "Array",
  "testNumber": "Number"
}

20200421

Mulesoft,两个月考证准备,每天进步一点点!_第42张图片
Mulesoft,两个月考证准备,每天进步一点点!_第43张图片

20200422

#[message.attributes.queryParams.firstName]

相当于

#[attributes.queryParams.firstName]

Mulesoft,两个月考证准备,每天进步一点点!_第44张图片
Mulesoft,两个月考证准备,每天进步一点点!_第45张图片

20200423

The For Each scope stores each item of the collection in payload during each iteration.
Mulesoft,两个月考证准备,每天进步一点点!_第46张图片
Mulesoft,两个月考证准备,每天进步一点点!_第47张图片

20200427

这几天沉迷于追剧不可自拔,老友记看到不亦乐乎还有最终幻想7重制版的剧情也不能错过,妹子美的快要掰弯我了顺便还看了几集甄嬛和延禧。。
在这里我深刻反省一下!
Mulesoft,两个月考证准备,每天进步一点点!_第48张图片
输出格式如下:

{
  "account_id": "KA-1",
  "name": "Max Mule",
  "position": "sell",
  "write_date": "2020-04-27T22:34:31.655+08:00"
}

20200430

Mulesoft,两个月考证准备,每天进步一点点!_第49张图片

20200502

accessible,payload可以,但vars.quantity和queryParams都丢失了
Mulesoft,两个月考证准备,每天进步一点点!_第50张图片
Mulesoft,两个月考证准备,每天进步一点点!_第51张图片

第46题参考:How-to-set-SOAP-header-for-Mule-4-Web-Service-Consumer
Mulesoft,两个月考证准备,每天进步一点点!_第52张图片

20200503

47.Validations Module
Validate Null
Fails if the value is not null and not an instance of NullPayload
payload != null => fail => response:Validation Error
Validate Is Blank String, 也是可能的考点。
Mulesoft,两个月考证准备,每天进步一点点!_第53张图片
48.On Error Continue
Executes and uses the result of the execution, as the result of its owner, as if the owner had actually completed the execution successfully.
If a transaction is being handled, it would be committed as well.

On Error Propagate
Executes but propagates the error to the next level up, breaking the owner’s execution.
If a transaction is being handled, it’s rolled back.
Mulesoft,两个月考证准备,每天进步一点点!_第54张图片
Mulesoft,两个月考证准备,每天进步一点点!_第55张图片
Mulesoft,两个月考证准备,每天进步一点点!_第56张图片

20200509

Mulesoft,两个月考证准备,每天进步一点点!_第57张图片
Mulesoft,两个月考证准备,每天进步一点点!_第58张图片

%dw 2.0
output application/xml
var conductorsId = [592,921]
---
trains:
{(
	conductorsId map( (engId, index)->{
		train:{
			engineerId:engId
		}
	})
)}
<?xml version='1.0' encoding='UTF-8'?>
>
    >
        >592>
    >
    >
        >921>
    >
>

20200511

51.Mulesoft,两个月考证准备,每天进步一点点!_第59张图片
52.
validation:is null -> Error Propagate -> flow’s error handler(Error Continue)
Try Scope
In the case of On Error Propagate, the error is propagated to the flow’s error handler, as if the Try scope did not exist.
In the case of On Error Continue, processing continues outside the Try scope at the next flow component, as if the Try scope never threw an exception.
Mulesoft,两个月考证准备,每天进步一点点!_第60张图片Mulesoft,两个月考证准备,每天进步一点点!_第61张图片

20200512

Mulesoft,两个月考证准备,每天进步一点点!_第62张图片
搭建ftp服务器:win10需要打开IIS,在IIS里添加ftp站点;创建新用户,把该站点的物理路径权限给到新用户;还要配置一下防火墙。

20200514

Mulesoft,两个月考证准备,每天进步一点点!_第63张图片
55.同第42题,For Each Scope的payload类似于局部变量,
Mulesoft,两个月考证准备,每天进步一点点!_第64张图片

20200515

#['MuleSoft' == payload.company]

Mulesoft,两个月考证准备,每天进步一点点!_第65张图片
57.http://localhost:8081/accounts/123
Mulesoft,两个月考证准备,每天进步一点点!_第66张图片
attributes.uriParams.employeeID如下图所示:
Mulesoft,两个月考证准备,每天进步一点点!_第67张图片

58.http://localhost:8081/accounts?account_type=retail&industry=financeMulesoft,两个月考证准备,每天进步一点点!_第68张图片
Mulesoft,两个月考证准备,每天进步一点点!_第69张图片
Mulesoft,两个月考证准备,每天进步一点点!_第70张图片

#["The payload is:" ++ payload]
The payload is:#[payload]

两者应该是等价的。

20200518

对比第45题,accessible,payload、vars.quantity和queryParams都还在。
Mulesoft,两个月考证准备,每天进步一点点!_第71张图片

20200520

61.Config Properties
Mulesoft,两个月考证准备,每天进步一点点!_第72张图片
Use the Properties in your Application
Once you have configured your properties file and added it to your project, you can reference its attributes by using a syntax like this: ${propertyContainer.propertyName}.

Based on the examples configured in the previous section, to use the path and port values the syntax is ${http.path} and ${http.port} respectively.

For example, you can configure your Global HTTP Request configuration to use the values defined in the properties file.

<http:request-config
  name="HTTP_Request_config"
  doc:name="HTTP Request
  configuration" doc:id="7120494c-0540-4ad1-a118-f5b6db3f1456"
  basePath="${http.path}" >
		<http:request-connection
      host="${http.host}"
      port="${http.port}" />
</http:request-config>

拒绝狗粮,从我做起(手动狗头)
https://docs.mulesoft.com/mule-runtime/4.1/mule-app-properties-to-configure

20200521

Mulesoft,两个月考证准备,每天进步一点点!_第73张图片
63.
Mulesoft,两个月考证准备,每天进步一点点!_第74张图片
Mulesoft,两个月考证准备,每天进步一点点!_第75张图片
64.map(Array, (item: T, index: Number) -> R): Array
Transforms items from the given list (array) into a new list using the specified mapper function.
Mulesoft,两个月考证准备,每天进步一点点!_第76张图片

20200524

Mulesoft,两个月考证准备,每天进步一点点!_第77张图片
66.Step 2. Design an API Specification
Mulesoft,两个月考证准备,每天进步一点点!_第78张图片

20200526

Mulesoft,两个月考证准备,每天进步一点点!_第79张图片
Example: Setting Up Watermarks with an Object Store
Mulesoft,两个月考证准备,每天进步一点点!_第80张图片
69.
Mulesoft,两个月考证准备,每天进步一点点!_第81张图片

20200528

70.payload和vars.quantity可见,queryParams.color不可见。对比参考45、60。
Mulesoft,两个月考证准备,每天进步一点点!_第82张图片
Mulesoft,两个月考证准备,每天进步一点点!_第83张图片
Mulesoft,两个月考证准备,每天进步一点点!_第84张图片
Mulesoft,两个月考证准备,每天进步一点点!_第85张图片
Mulesoft,两个月考证准备,每天进步一点点!_第86张图片
Mulesoft,两个月考证准备,每天进步一点点!_第87张图片
Mulesoft,两个月考证准备,每天进步一点点!_第88张图片

你可能感兴趣的:(Mulesoft)