GeoEvent: Custom "Non-null" JSON Adapter

694
0
04-06-2020 10:58 AM
EricIronside
Esri Regular Contributor
2 0 694

Updated 04/20/2021 - Now compatible with any GeoEvent Server version 10.6 or later

Updating Data "On Change"

In GeoEvent, when you write out data to an Update Features output, it will update the fields in an existing record (if that record already exists).  But I recently ran into a situation where a device was reporting several parameters, but only on change.  So the events over time might look like the following:

 

 

When I passed this data to the Update Features output, it updated the current values, but replaced the past values with the null value. I could have used a filter and a field reducer to remove the null fields, but I would have needed to do that for each field (10 filter/field reducers!!).

 

Custom, Non-null Feature JSON Adapter

Instead, I created a custom JSON Adapter (based on the OTTB JSON Adapter) that omitted any fields that were either NULL or Empty Strings. It has all of the same parameters as the OOTB adapter, with the addition of two more: Write Null Values? [Yes/No] and Write Empty Strings? [Yes/No]

 

 

Installation & Compatibility

This adapter is compatible with any version of GeoEvent Server 10.4 or later. To deploy, unzip the attached file and either upload the .jar file to GeoEvent Manager on Site > Components > Adapters using the Add Local Adapter button. Alternatively, you can copy the .jar file into the deploy folder of your GeoEvent Server installation (for windows that would typically be C:\Program Files\ArcGIS\Server\GeoEvent\deploy\ ).  The current release is marked version 0.1 (proof of concept). Please report any issues in the comments section of this blog.

 

Connectors

Installing the .jar file will create two outbound connectors for you. You can create additional connectors as needed.

 

Troubleshooting

Loggers that can help troubleshoot:

com.esri.geoevent.adapter.nonnulljson.FeatureJsonOutboundAdapterService
com.esri.geoevent.adapter.nonnulljson.FeatureJsonOutboundAdapter
com.esri.geoevent.adapter.nonnulljson.FeatureJsonOutboundConverter

 

About the Author
Esri Professional Services Real-Time GIS Team GeoEvent Sr. Product Enginner