Elasticsearch-06-Elasticsearch Java API Client

Foreword Introduction After Elasticsearch version 7.15, Elasticsearch officially marked its advanced client RestHighLevelClient as deprecated. At the same time, a new Java API client Elasticsearch Java API Client was launched, which will also become the officially recommended client in Elasticsearch 8.0 and later versions. The Elasticsearch Java API Client supports all Elasticsearch APIs except the […]

The use of Feign under Spring cloud multi-module development, and the solution to the exception that @FeignClient injects beans and cannot find it

1. About Feign In the development of microservice architecture, we often call other services in a project. In fact, this requirement can be achieved using Spring Cloud Ribbon. RestTemplate’s request interception is used to implement interface calls to dependent services. However, in actual projects, service dependencies There may be more than one call, and often […]

org.apache.http function graph flow (PoolingHttpClientConnectionManager, RequestConfig, HttpClientBuilder, HttpClient)

Create PoolingHttpClientConnectionManager -> Create RequestConfig -> Create HttpClientBuilder -> Create Closeable(HttpClient) -> Create HttpGet/Post and configure parameters -> Send request and get response -> Get and print response content import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.*; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; […]

client-go implements a controller that automatically creates ingress resources

need: If the created service annotation contains ingress/http: “true”, the ingress resource of the service will be automatically created. When ingress/http: “true” is deleted, the ingress will be automatically deleted. At the same time When you delete the service, the ingress will also be automatically deleted. Code directory structure tree ingress-expose ingress-expose ├── Dockerfile ├── […]

FTP protocol (client)

1. Introduction FTP (File Transfer Protocol) is a standard protocol for file transfer. Its main function is to transfer and share files between the server and the client. The FTP protocol runs over a TCP connection, ensuring the reliability of file transfers. FTP usually uses two ports, 20 and 21. Among them, port 21 is […]

Transitioning from RestTemplate to WebClient in SpringBoot (detailed guide)

Original link: https://medium.com/hprog99/transitioning-from-resttemplate-to-webclient-in-spring-boot-a-detailed-guide-4febd21063ba Author: Hiten Pratap Singh The Spring Framework’s RestTemplate has been the go-to solution for client-side HTTP access for years, providing a synchronous, blocking API to handle HTTP requests in a simple way. However, as the need for non-blocking, reactive programming to handle concurrency with fewer resources increases, especially in microservices architectures, RestTemplate […]

Based on httpclient dependency, encapsulate a tool class that is more suitable for your own business scenarios.

Use dependencies <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.13</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.8.0</version> </dependency> Tools public class HttpClientUtil {<!– –> private static HttpClientUtil httpClient; private final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); private final PoolingHttpClientConnectionManager cm; private final RequestConfig reqConfig; private final HttpClientBuilder clientBuilder; //Set concurrent access threads private final Semaphore semaphore = new Semaphore(300); {<!– –> ConnectionSocketFactory plainsf […]