简体   繁体   English

WSO2 esb 4.9.0支持Json pub sub

[英]WSO2 esb 4.9.0 support for Json pub sub

Currently when I setup a topic on WSO2 ESB 4.9.0, the pub/sub is only sending me the soap envelope message to the subscriber end-point. 当前,当我在WSO2 ESB 4.9.0上设置主题时,发布/订阅仅向我发送肥皂信封消息到订户端点。 Can we setup the ESB in a way that we send the incoming message as is? 是否可以以发送原样的方式设置ESB的方法?

When I send a message to publish on a topic as below, I am getting the below soap envelope response to all subscribers 当我发送消息以发布有关以下主题的消息时,我得到了以下所有用户的肥皂信封响应

POST to Topic
POST /TriggerTopic HTTP/1.1
Host: 10.224.234.34:8280
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 3453ddc5-a279-203a-fecf-38e81bd3ba8b

{"value":"some value"}

RESPONSE received by SUBSCRIBERS from TOPIC. 订阅者从TOPIC收到的回复。

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ns:topic xmlns:ns="http://wso2.org/ns/2009/09/eventing/notify">/TestTopic</ns:topic></soapenv:Header><soapenv:Body><jsonObject><value>some value</value></jsonObject></soapenv:Body></soapenv:Envelope>

Is there a way that we can pass the request object message as is to all the subscribers? 有没有一种方法可以将请求对象消息原样传递给所有订户?

The subscriber must specify the content type as application/json 订阅者必须将内容类型指定为application / json

Sample publisher : 样本发布者:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Publisher" transports="http" startOnLoad="true" trace="disable">
    <description/>
    <target>
        <inSequence>
            <property name="messageType" value="application/json" scope="axis2" type="STRING"/>
            <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2" type="STRING"/>
            <property name="OUT_ONLY" value="true"/>
            <send>
                <endpoint>
                    <address uri="jms:/dynamicTopics/TESTTOPIC?transport.jms.ConnectionFactory=myTopicConnectionFactory"/>
                </endpoint>
            </send>
        </inSequence>
    </target>
</proxy>

Sample subscriber : 样本订户:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Subscriber" transports="jms" startOnLoad="true" trace="disable">
    <description>subscriber</description>
    <target>
        <inSequence>
            <log level="full"/>
        </inSequence>
    </target>
    <parameter name="transport.jms.ContentType">
        <rules>
            <jmsProperty>contentType</jmsProperty>
            <default>application/json</default>
        </rules>
    </parameter>
    <parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter>
    <parameter name="transport.jms.DestinationType">topic</parameter>
    <parameter name="transport.jms.Destination">TESTTOPIC</parameter>
</proxy>

Send this json payload to http://localhost:8280/services/Publisher with SoapUI : {"value":"some value"} 使用SoapUI将此JSON有效负载发送到http://localhost:8280/services/Publisher{"value":"some value"}

find log : INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:xxx-59490-1467971573210-1:2:1:4:1, Direction: request, Payload: {"value":"some value"} 查找日志: INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:xxx-59490-1467971573210-1:2:1:4:1, Direction: request, Payload: {"value":"some value"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM