2

My requirement is to find the nearest coordinates in the given radius from all the input events i sent. Example:-My input will be like this comma separated values. Request:- "1,event1,11.923624,77.683522,ab1 2,event2,12.920947,77.672921,ab2 3,event3,12.929041,77.668179,ab3 4,event4,12.919567,77.670668,ab4" My output for a request to find the nearest coordinates within 1km radius from "12.920947,77.672921" should be this below. Response:- "2,event2,12.920947,77.672921,ab2 3,event3,12.929041,77.668179,ab3 4,event4,12.919567,77.670668,ab4" . I am sending this response via HTTP publisher.The problem is, I am not able to send all the three events in a single call to my HTTP service.Instead it is making three separate calls and sending the three events separately three times.I hope i am explaining properly.Any help would be really appreciated.Thanks!

Community
  • 1
  • 1
  • I would appreciate if you could elaborate more on your requirement...Are you trying to publish these events *to* wso2cep via the HTTP adapter? – Dilini Apr 10 '16 at 03:23
  • If I understood correct you want to collect events and send them as a one array using http publisher. If yes then in order to collect data you will have to use a window of some kind (time,batch.. etc) according to your requirement. AFAIK there is no straight forward way to achieve above other than writing a window extension. If you can explain your requirement we can try to help you more on this. – dnWick Apr 10 '16 at 05:23
  • My requirement is to find the nearest coordinates in the given radius from all the input events i sent.Example:-My input will be like this comma separated values.1,event1,11.923624,77.683522,ab1 2,event2,12.920947,77.672921,ab2 3,event3,12.929041,77.668179,ab3 4,event4,12.919567,77.670668,ab4. – Maruthi raja Apr 11 '16 at 10:32
  • @Dilini:Yes I am sending via HTTP adapter.Since my query is returning list of values I want to send the list of values to my HTTP service via Http publisher. – Maruthi raja Apr 11 '16 at 10:45
  • @@dnWick.YOu understood properly.Our problem is in sending the bunch of events to a publisher in single call.The windows function can be used only to aggregate the bunch of event from receiver. – Maruthi raja Apr 11 '16 at 11:11

1 Answers1

0

Similar kind of question has been raised before [1]. For you also this can be achieved if you could transform your CSV in to a XML structure something like following format and do the XML mapping in the receiver [2]

<result>
  <event>
      <id>1</id>
      <name>event1</name>
      <coordinate1>11.923624</coordinate1>
      <coordinate2>77.683522</coordinate2>
      <description>ab1</description>
  </event>
  <event>
      <id>2</id>
      <name>event2</name>
      <coordinate1>12.920947</coordinate1>
      <coordinate2>77.672921</coordinate2>
      <description>ab2</description>
  </event>
  <event>
      <id>3</id>
      <name>event3</name>
      <coordinate1>12.929041</coordinate1>
      <coordinate2>77.668179</coordinate2>
      <description>ab3</description>
  </event>
</result>

[1] Can CEP http receiver receive multi data nodes one time

[2] https://docs.wso2.com/display/CEP410/Input+Mapping+Types#InputMappingTypes-XMLinputmappingXMLInputMapping

Community
  • 1
  • 1
Tharik Kanaka
  • 2,490
  • 6
  • 31
  • 54