Sorry for the late response. We didn't use any blocking operator when using 
HttpClient, therefore reuse should not have adverse effects.


Looking forward to your reply.

dragon-zhang

------------------ Original ------------------
From: XiaoYu <[email protected]&gt;
Date: Tue,Apr 12,2022 10:13 AM
To: dev <[email protected]&gt;
Subject: Re: How about reuse HttpClient in HttpClientPluginConfiguration for 
WebSocketPluginConfiguration ?



Hi&nbsp; dragon-zhang

After I reviewed the code, I had a little doubt,

if used `HttpClient` , it be used by divide and spring cloud plugin,

and then used by websocket plugin, Is not as good as the original
isolation? (I can't confirm).

Looking forward to your reply.

thanks!

邪龙(dragon-zhang) <[email protected]&gt; 于2022年4月11日周一 22:56写道:
&gt;
&gt; Hello community:
&gt;
&gt;
&gt; This is a discussion on whether to reuse HttpClient 
for&amp;nbsp;WebSocketPluginConfiguration.
&gt;
&gt;
&gt;
&gt; current WebSocketPluginConfiguration:
&gt;
&gt;
&gt; &amp;nbsp; &amp;nbsp; @Bean
&gt; &amp;nbsp; &amp;nbsp; public ReactorNettyWebSocketClient 
reactorNettyWebSocketClient(final ShenyuConfig shenyuConfig) {
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final 
ReactorNettyWebSocketClient webSocketClient = new ReactorNettyWebSocketClient();
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
webSocketClient.setMaxFramePayloadLength(shenyuConfig.getWebsocket().getMaxFramePayloadSize()
 * 1024 * 1024);
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return webSocketClient;
&gt; &amp;nbsp; &amp;nbsp; }
&gt;
&gt;
&gt; after reuse HttpClient in HttpClientPluginConfiguration:
&gt;
&gt;
&gt; &amp;nbsp; &amp;nbsp; @Bean
&gt; &amp;nbsp; &amp;nbsp; public ReactorNettyWebSocketClient 
reactorNettyWebSocketClient(final ShenyuConfig shenyuConfig,
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp;final ObjectProvider<HttpClient&amp;gt; httpClient) {
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; final 
ReactorNettyWebSocketClient webSocketClient = new 
ReactorNettyWebSocketClient(httpClient.getIfAvailable(HttpClient::create));
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
webSocketClient.setMaxFramePayloadLength(shenyuConfig.getWebsocket().getMaxFramePayloadSize()
 * 1024 * 1024);
&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return webSocketClient;
&gt; &amp;nbsp; &amp;nbsp; }
&gt;
&gt;
&gt; I think reuse could be better, how do you guys feel ?
&gt;
&gt;
&gt;
&gt; Looking forward to your reply.
&gt; dragon-zhang

Reply via email to