Java Callout to Read data from API Streaming

We have an API which is streaming enabled. There is a requirement to extract elements from the payload. We implemented the logic using JAVA Callout to extract.

But we are receiving empty request, when we tried to extract the request content. 

InputStream stream = msgCtx.getRequestMessage().getContentAsStream();

Can someone guide us with the right approach ?

0 4 185
4 REPLIES 4

Can anyone help us with above ask please ?

Not possible to work on request/response payloads when you enable streaming.

https://cloud.google.com/apigee/docs/api-platform/develop/enabling-streaming#whatelseshouldiknowabou...

 

We have an API which is streaming enabled. There is a requirement to extract elements from the payload.

You cannot do that. You cannot fulfill that requirement, given that constraint.

Hey @dchiesa1 , quick question on the same topic:
If our JavaPolicy performs

messageContext.getMessage().getContent()

On a proxy when streaming is enabled, will it cause Apigee to buffer the entire req/res?
We know for fact that this call returns an empty string, but we don't know the underlying implementation

(Reason I'm asking is because of Java policy is deployed as a Flowhook, so it should know to handle streaming and non streaming proxies)