尝试订阅消息队列时连接错误
Bad CONNECT when trying to subscribe to message queue
我是 RabbitMQ 的新手,现在我正在查找配置错误。客户端没有收到任何来自RabbitMQ的消息,我尽量调试了。
前端消息:
消息 1:
CONNECT
login:frontend_listener
passcode:xxx
accept-version:1.0,1.1,1.2
heart-beat:20000,0
消息 2:
ERROR
message:Bad CONNECT
content-type:text/plain
version:1.0,1.1,1.2
content-length:30
Virtual host '/' access denied
有两个 vHost:/
和 someVhost
,并且有不同的用户,例如 frontend_listener
。现在我found a way访问日志文件。
RabbitMQ 日志文件:
2020-02-11 15:50:53.579 [warning] <0.798.0> STOMP login failed for user "frontend_listener"
2020-02-11 15:50:53.579 [error] <0.798.0> STOMP error frame sent:
Message: "Bad CONNECT"
Detail: "Access refused for user 'frontend_listener'\n"
Server private detail: none
...
2020-02-11 15:51:25.349 [info] <0.850.0> Creating user 'frontend_listener'
2020-02-11 15:51:30.374 [info] <0.857.0> Setting permissions for 'frontend_listener' in 'someVhost' to '$', '$', 'client-notification.*'
2020-02-11 15:51:54.980 [warning] <0.867.0> STOMP login failed - not_allowed (vhost access not allowed)~n
2020-02-11 15:51:54.980 [error] <0.867.0> STOMP error frame sent:
Message: "Bad CONNECT"
Detail: "Virtual host '/' access denied"
Server private detail: none
2020-02-11 15:52:56.427 [warning] <0.875.0> STOMP login failed - not_allowed (vhost access not allowed)~n
好像权限不对。有人可以帮我正确解释吗?
我尝试阅读它:用户 frontend_listener
想要访问 vHost /
,但它没有足够的权限(不知道 $
这里的意思除了正则表达式的一部分)。问题是,我不知道那是否是正确的 vHost。如何找出每个 vHost 的 URL?
我问这个是因为我认为到 vHost 的映射是错误的或缺少某些东西。
编辑:
将 host: 'someVhost'
添加到我的 stomp-config.ts
后,我可以订阅队列了。现在我在日志中收到以下错误:
2020-02-12 16:32:25.913 [error] <0.5159.1> Channel error on connection <0.5149.1> (127.0.0.1:58136 -> 127.0.0.1:15674, vhost: 'someVhost', user: 'frontend_listener'), channel 1:
operation basic.consume caused a channel exception access_refused: access to queue 'stomp-subscription-SZ3-PO1-PbZroPol-WXSQw' in vhost 'someVhost' refused for user 'frontend_listener'
2020-02-12 16:32:26.022 [error] <0.5145.1> STOMP error frame sent:
Message: access_refused
在前端我没有收到消息或错误。
您还需要在 STOMP CONNECT
框架中传递主机信息..
这是规范所说的,客户必须设置这个 header
host : The name of a virtual host that the client wishes to connect to. It is recommended clients set this to the host name that the socket was established against, or to any name of their choosing. If this header does not match a known virtual host, servers supporting virtual hosting MAY select a default virtual host or reject the connection.
这就是您的 CONNET 框架的外观
CONNECT
login:frontend_listener
passcode:xxx
accept-version:1.0,1.1,1.2
host: someVhost
heart-beat:20000,0
我是 RabbitMQ 的新手,现在我正在查找配置错误。客户端没有收到任何来自RabbitMQ的消息,我尽量调试了。
前端消息:
消息 1:
CONNECT
login:frontend_listener
passcode:xxx
accept-version:1.0,1.1,1.2
heart-beat:20000,0
消息 2:
ERROR
message:Bad CONNECT
content-type:text/plain
version:1.0,1.1,1.2
content-length:30
Virtual host '/' access denied
有两个 vHost:/
和 someVhost
,并且有不同的用户,例如 frontend_listener
。现在我found a way访问日志文件。
RabbitMQ 日志文件:
2020-02-11 15:50:53.579 [warning] <0.798.0> STOMP login failed for user "frontend_listener"
2020-02-11 15:50:53.579 [error] <0.798.0> STOMP error frame sent:
Message: "Bad CONNECT"
Detail: "Access refused for user 'frontend_listener'\n"
Server private detail: none
...
2020-02-11 15:51:25.349 [info] <0.850.0> Creating user 'frontend_listener'
2020-02-11 15:51:30.374 [info] <0.857.0> Setting permissions for 'frontend_listener' in 'someVhost' to '$', '$', 'client-notification.*'
2020-02-11 15:51:54.980 [warning] <0.867.0> STOMP login failed - not_allowed (vhost access not allowed)~n
2020-02-11 15:51:54.980 [error] <0.867.0> STOMP error frame sent:
Message: "Bad CONNECT"
Detail: "Virtual host '/' access denied"
Server private detail: none
2020-02-11 15:52:56.427 [warning] <0.875.0> STOMP login failed - not_allowed (vhost access not allowed)~n
好像权限不对。有人可以帮我正确解释吗?
我尝试阅读它:用户 frontend_listener
想要访问 vHost /
,但它没有足够的权限(不知道 $
这里的意思除了正则表达式的一部分)。问题是,我不知道那是否是正确的 vHost。如何找出每个 vHost 的 URL?
我问这个是因为我认为到 vHost 的映射是错误的或缺少某些东西。
编辑:
将 host: 'someVhost'
添加到我的 stomp-config.ts
后,我可以订阅队列了。现在我在日志中收到以下错误:
2020-02-12 16:32:25.913 [error] <0.5159.1> Channel error on connection <0.5149.1> (127.0.0.1:58136 -> 127.0.0.1:15674, vhost: 'someVhost', user: 'frontend_listener'), channel 1:
operation basic.consume caused a channel exception access_refused: access to queue 'stomp-subscription-SZ3-PO1-PbZroPol-WXSQw' in vhost 'someVhost' refused for user 'frontend_listener'
2020-02-12 16:32:26.022 [error] <0.5145.1> STOMP error frame sent:
Message: access_refused
在前端我没有收到消息或错误。
您还需要在 STOMP CONNECT
框架中传递主机信息..
这是规范所说的,客户必须设置这个 header
host : The name of a virtual host that the client wishes to connect to. It is recommended clients set this to the host name that the socket was established against, or to any name of their choosing. If this header does not match a known virtual host, servers supporting virtual hosting MAY select a default virtual host or reject the connection.
这就是您的 CONNET 框架的外观
CONNECT
login:frontend_listener
passcode:xxx
accept-version:1.0,1.1,1.2
host: someVhost
heart-beat:20000,0