Streaming Through Service Callout policy

I am trying to do a streaming through service callout policy and it fails, but if I use regular target it is successful. Whether service callout policy will not support streaming, below is my service call out policy.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Service-Callout-1">
    <DisplayName>Service Callout-1</DisplayName>
    <Request variable="request"></Request>
    <Response>crsResponse</Response>
    <HTTPTargetConnection>
        <URL>https://xxxx/sites/default/files/swagger-files</URL>
        <Properties>
            <Property name="request.streaming.enabled">true</Property>
            <Property name="response.streaming.enabled">true</Property>
        </Properties>
    </HTTPTargetConnection>
</ServiceCallout>
Solved Solved
1 2 542
1 ACCEPTED SOLUTION

I don't know if the ServiceCallout supports streaming. I believe it does not.

Also I'm not even sure how that would work; the original design for the ServiceCallout expected to satisfy a need for the API Proxy to make a synchronous request for additional information. Where would the response stream to?

I think if you want to make an asynch, fire-and-forget request to a backend system you have a couple good alternatives.

  • JavaScript callout, with the httpclient.
  • a nodejs target, using whatever wrapper of the http client you like. (like the request module, etc)

The first is potentially attractive if you have one request to make. Here's a good illustration.

The latter is more attractive if you have a larger number of requests to make, or if the number of requests is dynamic and non-deterministic. For example if based on the response from one request, the logic might decide to then make other requests.

Do you think this will satisfy your requirements?

View solution in original post

2 REPLIES 2

I don't know if the ServiceCallout supports streaming. I believe it does not.

Also I'm not even sure how that would work; the original design for the ServiceCallout expected to satisfy a need for the API Proxy to make a synchronous request for additional information. Where would the response stream to?

I think if you want to make an asynch, fire-and-forget request to a backend system you have a couple good alternatives.

  • JavaScript callout, with the httpclient.
  • a nodejs target, using whatever wrapper of the http client you like. (like the request module, etc)

The first is potentially attractive if you have one request to make. Here's a good illustration.

The latter is more attractive if you have a larger number of requests to make, or if the number of requests is dynamic and non-deterministic. For example if based on the response from one request, the logic might decide to then make other requests.

Do you think this will satisfy your requirements?

I wanted to confirm service callout policy will not support streaming. But apigee documentation says yes ( service-callout-policy ) so confused .. Thanks for the options..