Can CEP http receiver receive multi data nodes one time

三世轮回 提交于 2019-12-12 02:08:42

问题


I used ESB to transform the XML message to CEP http receiver, the XML:

<result>
  <event>
      <tag>0101A01B001</tag>
      <time>10:00:01</time>
      <value>30.45</value>
  </event>
  <event>
      <tag>0101A01B001</tag>
      <time>10:00:02</time>
      <value>33.7</value>
  </event>
  <event>
      <tag>0101A01B001</tag>
      <time>10:00:03</time>
      <value>23.4</value>
  </event>
  <event>
      <tag>0101A01B001</tag>
      <time>10:00:04</time>
      <value>33.15</value>
  </event>
</result>

And the http receiver in CEP :

<?xml version="1.0" encoding="UTF-8"?>
  <eventReceiver name="recv_dss1" statistics="disable" trace="enable" xmlns="http://wso2.org/carbon/eventreceiver">
    <from eventAdapterType="http">
      <property name="transports">all</property>
    </from>
    <mapping customMapping="enable" type="xml">
      <property>
          <from xpath="/result/data/tag"/>
          <to name="tag" type="string"/>
      </property>
      <property>
          <from xpath="/result/data/time"/>
          <to name="time" type="long"/>
      </property>
      <property>
          <from xpath="/result/data/value"/>
          <to name="value" type="double"/>
      </property>
    </mapping>
    <to streamName="dss_stream3" version="1.0.0"/>
 </eventReceiver>

The http receiver only receive the first "event" node every time, so how to config the receiver can receive all the "event" nodes one time ?


回答1:


In the configuration you need to configure "Parent Selector XPath Expression" to indicate the parent element of the events, in this case its /result.

Then elements of the event should be referred from the parent tag, e.g. /data/time

Refer to WSO2 CEP 4.1 XML input mapping documentation for details : https://docs.wso2.com/display/CEP410/Input+Mapping+Types#InputMappingTypes-XMLinputmappingXMLInputMapping



来源:https://stackoverflow.com/questions/36587196/can-cep-http-receiver-receive-multi-data-nodes-one-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!