You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampipes.apache.org by "Florian Micklich (Jira)" <ji...@apache.org> on 2022/11/22 12:13:00 UTC

[jira] [Commented] (STREAMPIPES-643) unclear missleading example code writing own processor on website

    [ https://issues.apache.org/jira/browse/STREAMPIPES-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17637225#comment-17637225 ] 

Florian Micklich commented on STREAMPIPES-643:
----------------------------------------------

I added the corrected version.
Some Variables declarations were missing.

Also for better understanding for the beginner user, another variables names should be used!
 [^GeofencingProcessor-1.java] 


> unclear missleading  example code writing own processor on website
> ------------------------------------------------------------------
>
>                 Key: STREAMPIPES-643
>                 URL: https://issues.apache.org/jira/browse/STREAMPIPES-643
>             Project: StreamPipes
>          Issue Type: Task
>            Reporter: Florian Micklich
>            Priority: Major
>         Attachments: GeofencingProcessor-1.java, GeofencingProcessor.java
>
>
> 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:
> {code:java}
> String latitudeFieldName = extractor.mappingPropertyValue("latitude-field");
> String longitudeFieldName = extractor.mappingPropertyValue("longitude-field");
> {code}
> 1) Shouldn't it be:
> {code:java}
> String latitudeFieldName = parameters.extractor().mappingPropertyValue("latitude-field");
> String longitudeFieldName = parameters.extractor().mappingPropertyValue("longitude-field");
> {code}
> 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
> {code:java}
> float latitude = event.getFieldBySelector(latitudeFieldName).getAsPrimitive().getAsFloat();
> float longitude = event.getFieldBySelector(longitudeFieldName).getAsPrimitive().getAsFloat();
> {code}
> 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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)