فهرست منبع

feign请求配置文件(修复请求超时、压缩请求)

ZhangWenQiang 5 سال پیش
والد
کامیت
22075e6a50

+ 17 - 2
happy-cloud-auth/src/main/resources/bootstrap.yml

@@ -18,10 +18,25 @@ spring:
     sentinel:
       transport:
         dashboard: happy-cloud-sentinel:8888
-# 开启Feign对Sentinel 的支持
+#feign配置
 feign:
+  hystrix:
+    enabled: true  # 开启feign支持hystrix
   sentinel:
-    enabled: true
+    enabled: true  # 开启Feign对Sentinel 的支持
+  client:
+    config:
+      default:
+        connectTimeout: 60000
+        readTimeout: 60000
+        loggerLevel: basic
+  compression:
+    request:
+      enabled: true # 开启feign请求时的压缩, application client -> application service
+      mime-types: text/xml,application/xml,application/json # # 设置可以压缩的请求/响应的类型。
+      min-request-size: 512 # 当请求的数据容量达到多少的时候,使用压缩。默认是2048字节
+    response:
+      enabled: true # 开启feign技术响应时的压缩,  application service -> application client
 resttemplate:
   sentinel:
     enabled: true

+ 17 - 2
happy-cloud-system/happy-cloud-system-biz/src/main/resources/bootstrap.yml

@@ -17,10 +17,25 @@ spring:
     sentinel:
       transport:
         dashboard: happy-cloud-sentinel:8888
-# 开启Feign对Sentinel 的支持
+#feign配置
 feign:
+  hystrix:
+    enabled: true  # 开启feign支持hystrix
   sentinel:
-    enabled: true
+    enabled: true  # 开启Feign对Sentinel 的支持
+  client:
+    config:
+      default:
+        connectTimeout: 60000
+        readTimeout: 60000
+        loggerLevel: basic
+  compression:
+    request:
+      enabled: true # 开启feign请求时的压缩, application client -> application service
+      mime-types: text/xml,application/xml,application/json # # 设置可以压缩的请求/响应的类型。
+      min-request-size: 512 # 当请求的数据容量达到多少的时候,使用压缩。默认是2048字节
+    response:
+      enabled: true # 开启feign技术响应时的压缩,  application service -> application client
 resttemplate:
   sentinel:
     enabled: true

+ 17 - 1
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/resources/bootstrap.yml

@@ -16,9 +16,25 @@ spring:
     sentinel:
       transport:
         dashboard: happy-cloud-sentinel:8888
+#feign配置
 feign:
+  hystrix:
+    enabled: true  # 开启feign支持hystrix
   sentinel:
-    enabled: true
+    enabled: true  # 开启Feign对Sentinel 的支持
+  client:
+    config:
+      default:
+        connectTimeout: 60000 # 连接超时时间,设置60s
+        readTimeout: 60000
+        loggerLevel: basic
+  compression:
+    request:
+      enabled: true # 开启feign请求时的压缩, application client -> application service
+      mime-types: text/xml,application/xml,application/json # # 设置可以压缩的请求/响应的类型。
+      min-request-size: 512 # 当请求的数据容量达到多少的时候,使用压缩。默认是2048字节
+    response:
+      enabled: true # 开启feign技术响应时的压缩,  application service -> application client
 resttemplate:
   sentinel:
     enabled: true