Sajumon Joseph
Sajumon Joseph

Reputation: 31

Use Chroicle Queue to cache Http Response object

I have a use case where we need to persist Http Response (https://square.github.io/okhttp/4.x/okhttp/okhttp3/-response/) into a Chronicle Queue. Since this response object is coming from OkHttp module, I can't make it Marshallable so that I can write it to a Chronicle Queue.

I only care about the HTTP Status code (Integer), HTTP Header values (Array of String) and ByteStream or byte[]. I like to minimize the number of objects getting created if possible (to reduce GC). If I need to extract data from "Response" object to a custom POJO that is Marshallable, won't that add more objects to be GCed?

This will be a great example as I can think of many applications having similar use cases (of handling the rate of message production/consumption in HTTP applications).

I tried to create a POJO from the OkHttp response object. I am not able to persist the data into the Chronicle Queue as it complaints about java.net classes are not Marshallable.

Upvotes: 1

Views: 27

Answers (0)

Related Questions