pillar
pillar copied to clipboard
Stream read query
The lib doesn't support read response as stream isn't it?
Yes, lib doesn't support this.
Is this supported via HTTP?
Yes, when the server respond with headers Transfer-Encoding: chunked
and then, the body is <chunk_size><chunk><chunk_size><chunk>....
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#examples
elixir Finch lib support this (uses Mint under the hood), with Finch.stream/5
method. I have use Finch because I needed to download clickhouse response in stream
HTTPoison supports async responses too but I don't recommend any use of HTTPoison because of hackney latest versions...
You can simplify this package A LOT by just using Finch, which already provides pool of conns
Right now we paused development of Pillar until September, in this way i advise you to make fork with branch https://github.com/balance-platform/pillar/pull/26 and add Finch HTTP Client
With a stream if you need to query a lot of data to do processing on, you can do so without buffering everything first. I also need this and I think @sonic182 is right that Finch seems like a great option, as it does pooling out of the box and also supports streaming.