未根据配置在RabbitMQ服务器上创建Virtualhost 我要确保RabbitMQ上有VH aka虚拟主机。 我是否缺少某些配置。 请在下面找到配置
application.yml
spring:
rabbitmq:
host: 127.0.0.1
virtual-host: /defaultVH
username: defaultUser
password: defaultPassword
cloud:
stream:
bindings:
saviyntSampleQueueA:
binder: rabbit-A
contentType: application/x-java-object
group: groupA
destination: saviyntSampleQueueA
saviyntSampleQueueB:
binder: rabbit-B
contentType: application/x-java-object
group: groupB
destination: saviyntSampleQueueB
binders:
rabbit-A:
defaultCandidate: false
inheritEnvironment: false
type: rabbit
environment:
spring:
rabbitmq:
host: 127.0.0.1
virtualHost: /vhA
username: userA
password: paswdA
port: 5672
connection-timeout: 10000
rabbit-B:
defaultCandidate: false
inheritEnvironment: false
type: rabbit
environment:
spring:
rabbitmq:
host: 127.0.0.1
virtualHost: /vhB
username: userB
password: paswdB
port: 5672
connection-timeout: 10000
bootstrap.yml
############################################
# default settings
############################################
spring:
main:
banner-mode: "off"
application:
name: demo-service
cloud:
config:
enabled: true #change this to use config-service
retry:
maxAttempts: 3
discovery:
enabled: false
fail-fast: true
override-system-properties: false
server:
port: 8080
添加了默认的Spring Boot添加了启用绑定
@EnableBinding({MessageChannels.class})
@SpringBootApplication
public class Configissue1124Application {
public static void main(String[] args) {
SpringApplication.run(Configissue1124Application.class, args);
}
}
现在简单易用的按摩通道即可发送按摩
interface MessageChannels {
@Input("saviyntSampleQueueA")
SubscribableChannel queueA();
@Input("saviyntSampleQueueB")
SubscribableChannel queueB();
}
当我运行启动应用程序时,它没有在系统上创建任何虚拟主机。我尝试使用配置服务器购买提供相同的配置,但仍然没有运气 你能找到是否缺少一些东西吗?
预先感谢
答案 0 :(得分:0)
AMQP协议(或RabbitMQ REST API)不提供从客户端供应虚拟主机的机制。
必须在服务器上手动设置虚拟主机。