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 […]
Tag: client
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 […]
High Level Rest Client is not available? Try Java API Client to operate ES
Java API Client operates ES Article directory Java API Client operates ES Preface 1. What needs to be introduced to use Java API Client? 2. Usage steps 1. Create index 1. Alias operation 3. Data writing 4.Query Summarize Foreword When I was studying ES7.16 before, the government no longer recommended the use of High Level […]
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 ├── […]
5. W5100S/W5500+RP2040 Raspberry Pi Pico<UDP Client Data Loopback Test>
Article directory 1 Introduction 2. Introduction to the protocol 2.1 Brief description 2.2 Advantages 2.3 Application 3. WIZnet Ethernet chip 4. UDP Client loopback test 4.1 Program flow chart 4.2 Test preparation 4.3 Connection method 4.4 Related code 4.5 Test phenomena 5. Precautions 6. Related links 1. Preface UDP is a connectionless network protocol that […]
3. W5100S/W5500+RP2040 Raspberry Pi Pico<TCP Client Data Loopback Test>
Article directory 1 Introduction 2. Introduction to the protocol 2.1 Brief description 2.2 Advantages 2.3 Application 3. WIZnet Ethernet chip 4. TCP Client data loopback test 4.1 Program flow chart 4.2 Test preparation 4.3 Connection method 4.4 Related code 4.5 Test phenomena 5. Precautions 6. Related links 1. Preface In today’s computer network environment, TCP […]
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 […]