user3520080
user3520080

Reputation: 443

Migrating to the New HTTP Connector

I've upgraded from Mule 3.3.x to 3.6.x and since the old http endpoint is deprecated in 3.6.x I wanted to migrate to the new HTTP connector.

Here is the original code for calling a webservice and healthcheck

Webservice

<http:outbound-endpoint connector-ref="NoSessionConnector"
                            address="${testmigrationapp.endpoint.url}"
                            responseTimeout="${testmigrationapp.endpoint.timeout}" keep-alive="true"
                            responseTransformer-refs="errorHandler">
        <jms:transaction action="ALWAYS_JOIN"/>

Healthcheck

<http:inbound-endpoint exchange-pattern="request-response" address="${testmigrationapp.healthcheck.address}" doc:name="HTTP"/>

How would I implement this using the new HTTP connector?

Thanks

Upvotes: 1

Views: 503

Answers (1)

afelisatti
afelisatti

Reputation: 2835

An HTTP outbound endpoint would translate to an HTTP request. You will need to define a request-config specifying the host, port and persistent connections (because of the keep-alive=true). Then you can replace the outbound endpoint with a request element specifying the URL path and the response timeout. For example:

<http:request-config name="persistentRequestConfig" usePersistentConnections="true" host="example.com" port="80" />

<flow name="persistent">
    <http:request config-ref="persistentRequestConfig" path="/" responseTimeout="30" />
</flow>

An HTTP inbound endpoint would translate to an HTTP listener. You will need to define a listener-config specifying the host and port. Then you can replace the inbound endpoint for a listener element specifying the URL path. For example:

<http:listener-config name="listenerConfig" host="0.0.0.0" port="8081"/>

<flow name="testFlow">
    <http:listener config-ref="listenerConfig" path="/"/>
    <echo-component/>
</flow>

For more details you can checkout our docs regarding the migration.

Upvotes: 2

Related Questions