How to implement java http long connection push data?
扔个三星炸死你2017-06-28 09:22:59
0
2
924
Two java services, connected using http long connection, pushed from service one to service two. I would like to ask, how should the two services be implemented?
In fact, if you use the latest HTTP components, they can already optimize this problem by themselves
Feign uses the JDK's native URLConnection to send HTTP requests by default. There is no connection pool, but a long connection is maintained for each address, that is, the persistence connection of HTTP is used. We can replace Feign's original http client with Apache's HTTP Client to gain control over performance such as connection pools and timeouts. Spring Cloud supports this replacement starting from Brixtion.SR5 version. First declare Apache HTTP Client and feign-httpclient dependencies in the project
Correction
Just checked
In fact, if you use the latest HTTP components, they can already optimize this problem by themselves
`
socket.io