我们的服务目前使用 spring cloud netflix zuul 作为我们的网关。
现在我们要支持websocket,所以我们需要将zuul 1迁移到zuul 2或spring cloud gateway。
我知道 spring 云团队不再支持 zuul,因为他们有自己的 spring 云网关。
我简要地研究了 zuul 2.0,我知道我们应该先改变过滤器的东西
并且没有更多的@EnableZuulProxy。(application.yml 中的路由配置怎么样?)
所以我的问题是,是否有将 zuul 1.0 迁移到 2.0 的参考或简单文档?
或者我们必须重建我们的网关应用程序?
任何帮助,将不胜感激!
if (res.getBody() == null || res.getBody().getServiceResult() == null) {
return; //
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,sonarlint 抱怨 SonarLint: A "NullPointerException" 可能会被抛出;“getBody()”可以返回 null。(来自 res.getBody().getServiceResult() )
我认为“res.getBody() == null”首先检查 null,因此它应该转到返回行,而不是到达下一个 if 条件。
我是不是在想什么问题?
I recently changed my cloud server OS from Ubuntu 20.04 to 22.04. After that, remote upload jar task fail during gradle build using org.hidetake.ssh with below message.
com.jcraft.jsch.JSchException: Auth fail
I guess it could be a RSA problem which is deprecated on Ubuntu 22.04 but I can't find how to resolve it.
The config I'm used with ssh.run task is below. I would really appreciate if anyone has idea.
remotes {
myServer {
host = 'x.x.x.x'
port = 22
user …Run Code Online (Sandbox Code Playgroud) 我正在使用 Spring boot 2.2.5 和 Spring data redis 和 bitnami/redis-sentinel Sentinel docker 镜像。
bitnami/redis-sentinel docker 镜像与 docker compose 配合得很好。
我可以使用 redis-cli 连接到 redis。(cli 显示 127.0.0.1:6379 已连接)
但在我本地的 Spring boot 应用程序中,它不起作用。错误跟踪如下:
org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.28.0.2:6379
at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:109) ~[spring-data-redis-2.2.5.RELEASE.jar:2.2.5.RELEASE]
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 172.28.0.2:6379
at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78) ~[lettuce-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /172.28.0.2:6379
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:261) ~[netty-transport-4.1.45.Final.jar:4.1.45.Final]
Run Code Online (Sandbox Code Playgroud)
IP地址172.28.0.2是docker镜像中的redis master ip。
我的哨兵主机配置如下,127.0.0.1:26379,127.0.0.1:26379,127.0.0.1:26379
我想我的应用程序通过本地主机哨兵配置很好地获取了主信息。
那么为什么我的应用程序为 master 找到 …
我正在将传统的 Spring 应用程序切换到 Spring Boot。
使用 spring cloud stream rabbitmq 迁移 rabbitmq 代码存在问题。
在遗留系统中,rabbitmq 队列是通过提供交换、路由密钥和队列名称来设置的。
例如,
exchange name = mq-test.topic
routingKey = mq-test
queueName = aa.mq-test
Run Code Online (Sandbox Code Playgroud)
所以在rabbitmq 管理视图中我可以看到exchange 是mq-test.topic,queue 是aa.mq-test。
但是对于 Spring Cloud 流,队列名称点缀着目的地,例如
mq-test.topic.aa.mq-test
我的 spring 云流属性是这样的。
spring.cloud.stream.bindings.channelName.destination=mq-test.topic
spring.cloud.stream.bindings.channelName.producer.bindingRoutingKey=mq-test
spring.cloud.stream.bindings.channelName.producer.requiredGroups=aa.mq-test
Run Code Online (Sandbox Code Playgroud)
我还代表 bindingRoutingKey 使用了 routingKeyExpression 属性,但结果是一样的。
有遗留应用程序通过队列名称使用数据,而我的新应用程序仅生成数据,因此我无法更改交换和队列名称策略。
如何使用 Spring Cloud 流保持交换/队列命名?
任何帮助表示赞赏。