CEP http接收器可以一次接收多个数据节点吗? [英] Can CEP http receiver receive multi data nodes one time

查看:90
本文介绍了CEP http接收器可以一次接收多个数据节点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ESB将XML消息转换为CEP http接收者XML:

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>

还有CEP中的http接收器:

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>

http接收器每次仅接收第一个事件"节点,因此如何配置接收器一次可以接收所有事件"节点?

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 ?

推荐答案

在配置中,您需要配置父选择器XPath表达式"以指示事件的父元素,在本例中为事件的父元素.

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

然后应从父标记引用事件的元素,例如/data/time

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

有关详细信息,请参阅WSO2 CEP 4.1 XML输入映射文档: https://docs.wso2.com/display/CEP410/Input+Mapping+Types#InputMappingTypes-XMLinputmappingXMLInputMapping

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

这篇关于CEP http接收器可以一次接收多个数据节点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆