Uploaded image for project: 'StreamPipes'
  1. StreamPipes
  2. STREAMPIPES-643

unclear missleading example code writing own processor on website

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 1.0.0
    • None
    • None

    Description

      I just wondering on the example with the 1 class processor here [1] [2].

      In the description is mentioned that

      Next, we are interested in the fields of the input event stream that contains the latitude and longitude value we would like to compute against the geofence center location as follows:

      String latitudeFieldName = extractor.mappingPropertyValue("latitude-field");
      String longitudeFieldName = extractor.mappingPropertyValue("longitude-field");
      

      1) Shouldn't it be:

      String latitudeFieldName = parameters.extractor().mappingPropertyValue("latitude-field");
      String longitudeFieldName = parameters.extractor().mappingPropertyValue("longitude-field");
      

      2) But this code snippet is is missing in "Your controller class should look as follows" example.

      3) The latitudeFieldName is used in the onEvent Method as

      float latitude = event.getFieldBySelector(latitudeFieldName).getAsPrimitive().getAsFloat();
      float longitude = event.getFieldBySelector(longitudeFieldName).getAsPrimitive().getAsFloat();
      

      But the variables can not be resolved.

      I but the example code into a file but better overview
      GeofencingProcessor.java

      [1] https://streampipes.apache.org/docs/docs/extend-tutorial-data-processors.html
      [2] https://github.com/apache/streampipes-website/blob/dev/documentation/docs/06_extend-tutorial-data-processors.md

      Attachments

        1. GeofencingProcessor.java
          5 kB
          Florian Micklich
        2. GeofencingProcessor-1.java
          6 kB
          Florian Micklich

        Activity

          People

            Unassigned Unassigned
            micklich Florian Micklich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: