API ゲートウェイの移行: Autodiscovery

Mule 4.1 の標準サポートは 2020 年 11 月 2 日に終了しました。このバージョンの Mule は、拡張サポートが終了する 2022 年 11 月 2 日にその すべてのサポート​が終了しました。

このバージョンの Mule を使用する CloudHub には新しいアプリケーションをデプロイできなくなります。許可されるのはアプリケーションへのインプレース更新のみになります。

標準サポートが適用されている最新バージョンの Mule 4 にアップグレード​することをお勧めします。これにより、最新の修正とセキュリティ機能強化を備えたアプリケーションが実行されます。

Autodiscovery 要素は Mule 4 のリリース後に更新されています。

  • API は、名前とバージョンではなく、ID で参照されます。

  • API をランタイムから作成できなくなりました。

HTTP リスナと Autodiscovery 要素を備えたシンプルな Mule アプリケーションは次のように定義されます。

Mule 3 の例: すべての設定可能な属性
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:api-platform-gw="http://www.mulesoft.org/schema/mule/api-platform-gw"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
       http://www.mulesoft.org/schema/mule/api-platform-gw http://www.mulesoft.org/schema/mule/api-platform-gw/current/mule-api-platform-gw.xsd">

    <api-platform-gw:api id="apiId" create="true" apiName="name" version="1.0.0" flowRef="flow_api">
        <api-platform-gw:description>This is a test API</api-platform-gw:description>
        <api-platform-gw:tag>tag1</api-platform-gw:tag>
        <api-platform-gw:tag>tag2</api-platform-gw:tag>
    </api-platform-gw:api>

    <http:listener-config name="httpConfig" host="localhost" port="${port}" />

    <flow name="flow_api">
        <http:listener config-ref="httpConfig" path="api" />
        <logger message="Executing empty" level="INFO"/>
    </flow>

</mule>
Mule 4 の例: すべての設定可能な属性
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns:api-gateway="http://www.mulesoft.org/schema/mule/api-gateway"
      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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
       http://www.mulesoft.org/schema/mule/api-gateway http://www.mulesoft.org/schema/mule/api-gateway/current/mule-api-gateway.xsd">

    <api-gateway:autodiscovery apiId="1" flowRef="flow_api" />

    <http:listener-config name="httpConfig" basePath="api">
        <http:listener-connection host="localhost" port="${port}"/>
    </http:listener-config>

    <flow name="flow_api">
        <http:listener config-ref="httpConfig" path="api" />
        <logger message="Executing empty" level="INFO"/>
    </flow>

</mule>