james
james

Reputation: 451

Mule ESB autogenerate HTTP parameters

I am new to Mule and I've been banging my head against the wall most of the day with this problem. I have the following flow:

 <flow name="flow1" doc:name="flow1">
        <poll frequency="1000">
            <logger message="starting" level="INFO" doc:name="Logger"/>
        </poll>
        <http:outbound-endpoint exchange-pattern="request-response" host="xxx.xxx.xxx.xxx" port="80" path="service_type/service?variable=epoch_timestamp" method="GET" doc:name="HTTP"/>
        <byte-array-to-string-transformer doc:name="Byte Array to String"/>
        <echo-component doc:name="Echo"/>
    </flow>
</mule>

I need to auto-generate the epoch timestamp as an argument to my service. The value should be the system time at the moment of the call. What is the best way of doing this in Mule?

Upvotes: 0

Views: 417

Answers (1)

genjosanzo
genjosanzo

Reputation: 3264

That can be achieved using one of the many mule Expression Evaluator

Depending on the version you might want to use either MEL (mule >= 3.3.0) or function (mule < 3.3.0)

In that case your outbound endpont will look like the following:

<http:outbound-endpoint exchange-pattern="request-response" host="xxx.xxx.xxx.xxx" port="80" path="service_type/service?variable=#[new Date().toString()]" method="GET" doc:name="HTTP"/>

Upvotes: 1

Related Questions