问题描述
我正在测试WSO2 Message Broker 3.0,但缺少将WS端点订阅主题的功能.可以像使用MB 2.x一样使用MB 3.0激活此功能吗?我正在尝试为WS-Endpoints实现可靠的(排队的)主题订阅.如何使用WSO2 MB 3.0实施?
I am testing WSO2 Message Broker 3.0 and I miss the functionality of subscribing WS endpoints to topics.Can this functionality be activated with MB 3.0 as it was in MB 2.x?I am trying to implement reliable (queued) topic subscription for WS-Endpoints. How can it be implemented using WSO2 MB 3.0?
推荐答案
WS-Eventing已从WSO2 MB 3.0.0中删除.但是您可以通过将WSO2 MB与WSO2 ESB集成来实现.这是用于可靠消息传递的广泛使用的通用集成模式,也可以在发送到实际后端之前,根据需要在WSO2 ESB中修改/中介消息.让我们看看我们如何做到这一点.
WS-Eventing removed from WSO2 MB 3.0.0. But you can achieve this by integrating WSO2 MB with WSO2 ESB. This is widely used common integration pattern for reliable messaging and also you could modify/mediate message as necessary in WSO2 ESB before send to actual backend. Let's see how we can do this.
我将向您展示如何在本地计算机中将WSO2 ESB与WSO2 MB集成.
I'll show you how to integrate WSO2 ESB with WSO2 MB in local machine.
-
从 http://wso2下载WSO2 ESB 4.9.0(最新版本) .com/products/enterprise-service-bus/.希望您已经拥有WSO2 MB 3.0.0(最新版本).
Download WSO2 ESB 4.9.0 (latest version) from http://wso2.com/products/enterprise-service-bus/. Hope you have WSO2 MB 3.0.0 (latest version) already in hand.
提取后,打开wso2esb-4.9.0/repository/conf/carbon.xml文件,然后将<Offset>0</Offset>
更改为<Offset>1</Offset>
.这使您可以在一台机器上运行多个Carbon服务器.您可以访问管理控制台 https://localhost:9444/carbon
Once you extract, open wso2esb-4.9.0/repository/conf/carbon.xml file and change <Offset>0</Offset>
to <Offset>1</Offset>
. This allow you to run multiple carbon servers in single machine. You can access management console https://localhost:9444/carbon
打开wso2esb-4.9.0/repository/conf/axis2/axis2.xml,并取消注释JMS传输接收器的<!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x-->
之后的部分和JMS传输发送器的<!--uncomment this and configure to use connection pools for sending messages-->
之后的部分.
Open wso2esb-4.9.0/repository/conf/axis2/axis2.xml and uncomment section after <!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x-->
for JMS transport receiver and section after <!--uncomment this and configure to use connection pools for sending messages-->
for JMS transport sender.
复制andes-client-3.0.1.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
wso2mb-3.0.0/client-lib
中的org.wso2.securevault-1.0.0-wso2v2.jar
至wso2esb-4.9.0/repository/components/lib
将以下条目添加到wso2esb-4.9.0/repository/conf/jndi.properties
connectionfactory.QueueConnectionFactory = amqp://admin:admin @ clientID/carbon?brokerlist ='tcp://localhost:5672'
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5672'
connectionfactory.TopicConnectionFactory = amqp://admin:admin @ clientID/carbon?brokerlist ='tcp://localhost:5672'
connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5672'
topic.MyDurableTopic = MyDurbleTopic
topic.MyDurableTopic = MyDurbleTopic
首先启动WSO2 MB,然后根据所使用的操作系统运行bin
文件夹中的wso2server.sh
或wso2server.bat
来启动WSO2 ESB
First start the WSO2 MB and then start WSO2 ESB by running wso2server.sh
or wso2server.bat
in bin
folder depending on OS you are using
集成完成.
让我们看看如何创建JMS侦听器代理,该代理在WSO2 MB中创建持久订阅.转到ESB管理控制台,选择代理服务->自定义代理->切换到源视图.然后复制并粘贴以下synapse配置以创建JMS侦听器.
Let's see how we can create JMS listener proxy which creates durable subscription in WSO2 MB. Go to ESB management console, select Proxy service -> Custom Proxy -> Switch to source view. Then copy and paste below synapse configuration to create the JMS listener.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MyDurableTopicListenerProxy"
transports="jms"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<log level="custom">
<property name="STATE" value="dispatch message..."/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>text/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.DestinationType">topic</parameter>
<parameter name="transport.jms.SubscriptionDurable">true</parameter>
<parameter name="transport.jms.Destination">MyDurbleTopic</parameter>
<parameter name="transport.jms.DurableSubscriberName">subId-x</parameter>
<parameter name="transport.jms.CacheLevel">consumer</parameter>
<parameter name="transport.jms.DurableSubscriberClientID">subId-x</parameter>
<description/>
</proxy>
您可以通过更改<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
替换任何WS端点.在这里,我使用了示例axis2后端.保存代理服务后,它将使用WSO2 MB中的MyDurableTopic创建持久订阅.您无需在WSO2 MB中创建MyDurableTopic.订阅将创建一个持久主题(根据JMS规范).
You can replace whatever the WS endpoint by changing <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
. Here I was used sample axis2 backend. Once you save the proxy service, it'll create durable subscription with MyDurableTopic in WSO2 MB. You don't need to create MyDurableTopic in WSO2 MB. Subscription will create a durable topic (according to JMS spec.).
现在,您可以将消息发送到持久主题,并查看将这些消息调度到WS端点.这是JMS到HTTP(跨协议)的传输.同样,您可以将标准模式与此设置集成.
Now you can send messages to durable topic and see those messages dispatch to WS endpoint. This is JMS to HTTP (cross protocol) transport. Likewise you can integrate standard pattern with this setup.
希望这会有所帮助!
干杯!
这篇关于WSO2 Message Broker 3.0.0和WS-Eventing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!