跳到主要内容

消息VPN桥接设置示例

以下示例展示了如何设置几种类型的消息VPN桥接。

默认情况下,客户端不能使用消息VPN桥接功能。必须为其分配的客户端配置文件启用使用桥接连接的权限。有关详细信息,请参阅允许桥接连接。

单向桥接示例

本示例展示了将本地事件代理上的消息VPN桥接到具有相同名称的远程事件代理上的消息VPN的命令序列。

首先,在本地事件代理上创建桥接(bridge-490)。

solace(configure)# create bridge bridge-490 message-vpn vpn-490

接下来,为远程事件代理配置设置。在以下示例中,远程消息VPN也称为vpn-490,桥接将使用IP地址192.168.164.50连接到远程事件代理。

solace(configure/bridge)# remote
solace(configure/bridge/remote)# create message-vpn vpn-490 connect-via 192.168.164.50

启用远程消息VPN。

solace(configure/bridge/remote/message-vpn)# no shutdown
solace(configure/bridge/remote/message-vpn)# exit

配置使用基本身份验证的连接。

solace(configure/bridge/remote)# authentication basic client-username default

配置订阅主题以标识将通过桥接传播的消息,<topic> 是订阅主题,然后退出远程事件代理的配置。

solace(configure/bridge/remote)# subscription-topic <topic>
solace(configure/bridge/remote)# exit

启用新桥接,然后退出其配置。

solace(configure/bridge)# no shutdown
solace(configure/bridge)# exit

双向桥接示例

本示例展示了将本地事件代理(solace1)上的消息VPN桥接到具有相同名称的远程事件代理(solace2)上的消息VPN的命令序列。消息可以在两个方向上转发。

在这个示例中,两个事件代理分别称为solace1solace2。在两个事件代理上都创建了一个名为bridge-490的消息VPN桥接。每个桥接都在本地消息VPN vpn-490上创建,并连接到另一个事件代理上具有相同名称的远程消息VPN。solace1事件代理在其桥接的一侧使用远程事件代理的connect-via地址,而solace2在桥接的另一侧使用远程事件代理的虚拟路由器名称。使用connect-via方法的桥接首先建立连接,然后另一个桥接重用该连接。您也可以在两端都使用connect-via地址;在这种情况下,两个桥接都尝试创建连接,较慢的桥接重用首先建立的桥接连接。虚拟路由器名称只能与双向桥接一起使用,并且只能在桥接的一端使用。两个桥接都配置了<topic>订阅主题。

首先,在solace1上使用solace2connect-via地址配置桥接:

solace1(configure)# create bridge bridge-490 message-vpn vpn-490
solace1(configure/bridge)# remote
solace1(configure/bridge/remote)# create message-vpn vpn-490 connect-via <solace2-ip-address>
solace1(configure/bridge/remote/message-vpn)# no shutdown
solace1(configure/bridge/remote/message-vpn)# exit
solace1(configure/bridge/remote)# authentication basic client-username default
solace1(configure/bridge/remote)# subscription-topic <topic>
solace1(configure/bridge/remote)# exit
solace1(configure/bridge)# no shutdown
solace1(configure/bridge)# exit

然后,在solace2上使用solace1的虚拟路由器名称配置桥接:

solace2(configure)# create bridge bridge-490 message-vpn vpn-490
solace2(configure/bridge)# remote
solace2(configure/bridge/remote)# create message-vpn vpn-490 router v:solace1
solace2(configure/bridge/remote/message-vpn)# no shutdown
solace2(configure/bridge/remote/message-vpn)# exit
solace2(configure/bridge/remote)# authentication basic client-username default
solace2(configure/bridge/remote)# subscription-topic <topic>
solace2(configure/bridge/remote)# exit
solace2(configure/bridge)# no shutdown
solace2(configure/bridge)# exit

单向回环桥接示例

回环桥接是链接同一事件代理上两个不同消息VPN的消息VPN桥接。

Solace建议对于回环桥接的远程消息VPN使用IP地址127.0.0.1,而不是事件代理的主IP地址。

在这个示例中,在同一个事件代理上创建了一个名为bridge-490的桥接,连接两个消息VPN。这两个消息VPN分别命名为vpn-490vpn00491。桥接配置了<topic>订阅主题。

solace(configure)# create bridge bridge-490 message-vpn vpn-490
solace(configure/bridge)# remote
solace(configure/bridge/remote)# create message-vpn vpn00491 connect-via 127.0.0.1
solace(configure/bridge/remote/message-vpn)# no shutdown
solace(configure/bridge/remote/message-vpn)# exit
solace(configure/bridge/remote)# authentication basic client-username default
solace(configure/bridge/remote)# subscription-topic <topic>
solace(configure/bridge/remote)# exit
solace(configure/bridge)# no shutdown
solace(configure/bridge)# exit

在VPN之间桥接保证消息的示例

保证消息可以从远程消息VPN通过消息VPN桥接到本地消息VPN以满足匹配的主题订阅。然而,如果您想确保传递到本地消息VPN的消息的传递模式不会更改为直连以满足本地消息VPN上匹配的客户端主题订阅,那么两端的桥接必须使用队列。也就是说,保证消息必须从一个队列传递,该队列在远程消息VPN上分配了适当的主题订阅,到另一个队列,该队列在本地消息VPN上分配了匹配的主题订阅。

如果桥接不以队列开始或结束,具有非持久传递模式的保证消息可以更改为直连以满足本地消息VPN上匹配的客户端主题订阅。当消息的传递模式发生变化时,不会提供警告或错误。有关更多信息,请参见消息降级。

以下示例展示了如何配置单向桥接,以便具有匹配主题的保证消息可以从远程消息VPN传递到本地消息VPN。在这个示例中:

  • 两个事件代理上的消息VPN都称为my_vpn
  • 两个事件代理上的队列都称为my_queue
  • local_userremote_userbridge_user都是适当的用户名占位符
  • 桥接配置了<topic>订阅主题
  1. 在本地和远程事件代理上创建队列。请注意,尽管两个队列的默认访问类型都是独占的,但只有远程队列必须是独占的。(有关队列访问类型的更多信息,请参阅使用Solace CLI配置VPN桥接的第4步)。
local(configure)# message-spool message-vpn my_vpn
local(configure/message-spool)# create queue my_queue
local(configure/message-spool/queue)# permission all modify-topic
local(configure/message-spool/queue)# owner local_user
local(configure/message-spool/queue)# subscription topic <topic>
local(configure/message-spool/queue)# no shutdown
remote(configure)# message-spool message-vpn my_vpn
remote(configure/message-spool)# create queue my_queue
remote(configure/message-spool/queue)# permission all modify-topic
remote(configure/message-spool/queue)# owner remote_user
remote(configure/message-spool/queue)# subscription topic <topic>
remote(configure/message-spool/queue)# no shutdown

有关如何在消息VPN中创建和配置队列的信息,请参阅消息VPN级保证消息配置。

  1. 创建单向桥接:
local(configure)# create bridge guaranteed_bridge message-vpn my_vpn
local(configure/bridge)# remote
local(configure/bridge/remote)# create message-vpn my_vpn connect-via <remote-broker-ip-address>
local(configure/bridge/remote/message-vpn)# message-spool queue my_queue
local(configure/bridge/remote/message-vpn)# no shutdown
local(configure/bridge/remote/message-vpn)# exit
local(configure/bridge/remote)# authentication basic client-username bridge_user
local(configure/bridge/remote)# exit
local(configure/bridge)# no shutdown

有关如何创建桥接和配置远程消息VPN的信息,请参阅配置VPN桥接。