mule anything studio 发布一个应用

添加组件 服务组件

  • http listener

  • http listener config

添加 请求组件

  • resquest
  • test.json
[
    {
        "ID": 1,
        "code1": "ER",
        "code2": "38sd",
        "takeOffDate": "2016/03/20",
        "fromAirport": "MUA",
        "price": 400,
        "seatsAvailable": 0,
        "toAirport": "SFO",
        "planeType": "Boeing 737",
        "totalSeats": 150
    },
    {
        "ID": 2,
        "code1": "ER",
        "code2": "45if",
        "takeOffDate": "2016/02/11",
        "fromAirport": "MUA",
        "price": 345.99,
        "seatsAvailable": "LAX",
        "planeType": "Boeing 777",
        "totalSeats": 300
    }
]
  • http resquest config

添加输出组件

  • transform Message

    *输出的json
[
    {
        "ID": 1,
        "code": "ER38sd",
        "price": 400,
        "departureDate": "2016/03/20",
        "origin": "MUA",
        "destination": "SFO",
        "emptySeats": 0,
        "plane": {
            "type": "Boeing 737",
            "totalSeats": 150
        }
    },
    {
        "ID": 2,
        "code": "ER45if",
        "price": 345.99,
        "departureDate": "2016/02/11",
        "origin": "MUA",
        "destination": "LAX",
        "emptySeats": 52,
        "plane": {
            "type": "Boeing 777",
            "totalSeats": 300
        }
    }
]

全部组件

启动模拟服务

cd ~
mkdir http_svc 
cd  http_svc   
cat test.json <<EOF
[
    {
        "code2": "0001111111",
        "takeOffDate": "2016/03/20",
        "code1": "ER38sd",
        "fromAirport": "MUA",
        "price": 400.00,
        "seatsAvailable": 0,
        "toAirport": "SFO",
        "ID": 1,
        "airlineName": "rreee",
        "planType": "Boeing 787",
        "totalSeats": 0
    },
    {
        "code2": "ER",
        "takeOffDate": "2016/02/11",
        "code1": "ER45if",
        "fromAirport": "MUA",
        "price": 345.99,
        "seatsAvailable": 52,
        "toAirport": "LAX",
        "ID": 2,
        "airlineName": "45if",
        "planType": "Boeing 747",
        "totalSeats": 532
    }
]
EOF
python3 -m http.server  8081
  • 浏览器访问 localhost:8081/test.json

启动 anyting studio

浏览器访问 mule

mvn 安装

mvn clean package -nsu -DskipMunitTests
  • clean:清空 target 目录,删除之前构建生成的临时文件。
  • package:将代码打包成可部署的格式(例如 JAR、WAR 等)。
  • -nsu:禁止从远程仓库更新快照(Snapshot)依赖,加快构建过程。
  • -DskipMunitTests:跳过运行 MUnit 单元测试。

mvn jar

mvn clean package -DattachMuleSources -DlightweightPackage
mvn install
posted @ 2023-04-06 09:51  vx_guanchaoguo0  阅读(8)  评论(0编辑  收藏  举报