Category : springcloud

Problem Some common components extract maven dependencies of other modules. At this time, it is not enough to only rely on @ComponentScan to load spring component and feign components of this jar package in the project in use. basekPackages must also be marked in @ EnableFeign Clients (BasePackages = {“com.xixicat”}). For maven compilation If configured ..

Read more

IsSecure parameters This parameter is only useful for services registered in eureka and not for external services using ribbon.listOfServers. Url designation The advantage of this method is that it is easy to use and specify directly. @FeignClient(value = “ssoService”,url = “https://sso.xixicat.com”) There is nothing else to configure. The bad thing is that you cannot use ..

Read more

Using feign.codec.ErrorDecoder @Configuration public class MyErrorDecoder implements feign.codec.ErrorDecoder { @Override public Exception decode(String methodKey, Response response) { if (response.status() == 404) { return new NotFoundException( response.status(), response.reason() ); } return errorStatus(methodKey, response); } } Extract cause Error Information HystrixRuntimeException.getCause()Instance of FeignException, if there is no custom errorDecoder;If an exception is customized, it is similar to ..

Read more

Get configuration curl -i http://config-server-host:port/{application}/{proflie} Main process ResourceController @RequestMapping(“/{name}/{profile}/{label}/**”) public String resolve(@PathVariable String name, @PathVariable String profile, @PathVariable String label, HttpServletRequest request) throws IOException { String path = getFilePath(request, name, profile, label); return resolve(name, profile, label, path); } Resolve method synchronized String resolve(String name, String profile, String label, String path) throws IOException { if (label ..

Read more

Overall process (Triggers the EnvironmentChangeEvent event) In response to the EnvironmentChangeEvent event (Rebind) RefreshEndpoint @ConfigurationProperties(prefix = “endpoints.refresh”, ignoreUnknownFields = false) @ManagedResource public class RefreshEndpoint extends AbstractEndpoint<Collection<String>> { private ContextRefresher contextRefresher; public RefreshEndpoint(ContextRefresher contextRefresher) { super(“refresh”); this.contextRefresher = contextRefresher; } @ManagedOperation public String[] refresh() { Set<String> keys = contextRefresher.refresh(); return keys.toArray(new String[keys.size()]); } @Override public Collection<String> ..

Read more

Overall process The default gitlab webhook update calls the/monitor (spring-cloud-config-monitor) of config server to trigger the RefreshRemoteApplicationEvent. Then the StreamListener of spring cloud bus listens to remoteapplicationovent, publishes it to each config client through mq, and then the client receives the remoteapplicationovent event to implement refresh. PropertyPathEndpoint/monitor @RequiredArgsConstructor @RestController @RequestMapping(path = “${spring.cloud.config.monitor.endpoint.path:}/monitor”) @CommonsLog public class ..

Read more

Default value Default maxAttempts value /Users/xixicat/.m2/repository/io/github/openfeign/feign-core/9.3.1/feign-core-9.3.1-sources.jar! /feign/Retryer.java public Default() { this(100, SECONDS.toMillis(1), 5); } public Default(long period, long maxPeriod, int maxAttempts) { this.period = period; this.maxPeriod = maxPeriod; this.maxAttempts = maxAttempts; this.attempt = 1; } Retry logic /Users/xixicat/.m2/repository/io/github/openfeign/feign-core/9.3.1/feign-core-9.3.1-sources.jar! /feign/Retryer.java public void continueOrPropagate(RetryableException e) { if (attempt++ >= maxAttempts) { throw e; } long interval; if ..

Read more

eureka.client.registry-fetch-interval-seconds Indicates how often eureka client pulls out the service registration information. The default is 30 seconds. For api-gateway, if you want to quickly obtain the service registration status, you can reduce this value, for example, 5 seconds. eureka.instance.lease-expiration-duration-in-seconds Leaseexpirationdurationseconds indicates the timeout period for eureka server to wait for the next heartbeat after it ..

Read more

Run atlas1.4.7 Download address curl -Lo memory.conf https://raw.githubusercontent.com/Netflix/atlas/master/conf/memory.conf java -jar atlas-1.4.7-standalone.jarmemory.conf Or use docker FROM netflixoss/java:8 MAINTAINER Netflix Open Source Development <talent@netflix.com> RUN apt-get -qq update &&\ apt-get -qq -y install ca-certificates &&\ mkdir -p /apps/atlas &&\ wget -q -P /apps/atlas ‘https://github.com/Netflix/atlas/releases/download/v1.4.7/atlas-1.4.7-standalone.jar’ ADD ./memory.conf /apps/atlas/memory.conf EXPOSE 7101 ENTRYPOINT [“/usr/bin/java”, “-jar”, “/apps/atlas/atlas-1.4.7-standalone.jar”,”/apps/atlas/memory.conf”] CMD [“run”] run docker ..

Read more

maven <!–spring boot admin–> <!– https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server –> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server</artifactId> <version>1.4.6</version> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </exclusion> </exclusions> </dependency> <!–&lt;!&ndash; https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server-ui-turbine &ndash;&gt;–> <!–<dependency>–> <!–<groupId>de.codecentric</groupId>–> <!–<artifactId>spring-boot-admin-server-ui-activiti</artifactId>–> <!–<version>1.4.6</version>–> <!–</dependency>–> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui-turbine</artifactId> <version>1.4.6</version> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>1.4.6</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> </dependency> Here, because the spring boot versions are inconsistent, eclude start web in admin server.Spring-boot-admin-server-ui-activiti didn’t ..

Read more

maven <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Camden.SR6</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream-binder-kafka</artifactId> </dependency> Producer allocation server: port: 8081 spring: application: name: output-demo cloud: instance-count: 1 instance-index: 0 stream: kafka: binder: brokers: localhost:9092 zk-nodes: localhost:2182 auto-add-partitions: true auto-create-topics: true min-partition-count: 1 bindings: output: destination: event-demo content-type: text/plain producer: partitionCount: 1 Java code @EnableBinding(Source.class) ..

Read more

Parameter reactor-core-2.0.8.RELEASE-sources.jar! /reactor/core/dispatch/ThreadPoolExecutorDispatcher.java /** * Create a new {@literal ThreadPoolExecutorDispatcher} with the given size, backlog, name, and {@link * java.util.concurrent.RejectedExecutionHandler}. * * @param poolSize * the pool size * @param backlog * the backlog size * @param threadName * the name prefix to use when creating threads * @param rejectedExecutionHandler * the {@code RejectedExecutionHandler} to ..

Read more