我需要根据消息中的参数“host”将消息分派到不同的vhost/transport。是否可以在Symfony 4的标准Messenger组件中执行此操作。*?我在每台服务器上都有工作机,并且所有工作机都连接到具体的vhost。
framework:
messenger:
serializer:
default_serializer: messenger.transport.symfony_serializer
symfony_serializer:
format: json
context: { }
transports:
wendy:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%/server-wendy'
options:
exchange:
name: wendy
type: direct
queues:
virtual_hosts:
durable: 1
binding_keys: ['virtual_hosts']
ftp:
durable: 1
binding_keys: ['ftp']
stan:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%/server-stan'
options:
exchange:
name: stan
type: direct
queues:
virtual_hosts:
durable: 1
binding_keys: ['virtual_hosts']
ftp:
durable: 1
binding_keys: ['ftp']
routing:
# Route your messages to the transports
'App\Message\VirtualHostNotification': [wendy, stan]
例如:
$this->messageBus->dispatch(
new VirtualHostNotification($virtualHost),
[new AmqpStamp('wendy.virtual_hosts', AMQP_NOPARAM)],
$transport,
$vhost
);
1条答案
按热度按时间q5iwbnjs1#
添加“vhost”变量。例如: