Class JSONResourceWrapper

All Implemented Interfaces:
Configurable

public class JSONResourceWrapper extends ParseFilter
Wraps a ParseFilter whose resources are in a JSON file that can be stored in OpenSearch. The benefit of doing this is that the resources can be refreshed automatically and modified without having to recompile the jar and restart the topology. The connection to OpenSearch is done via the config and uses a new bolt type 'config'.

The configuration of the delegate is done in the parsefilters.json as usual.

  {
     "class": "com.digitalpebble.stormcrawler.elasticsearch.parse.filter.JSONResourceWrapper",
     "name": "OpenSearchCollectionTagger",
     "params": {
         "refresh": "60",
         "delegate": {
             "class": "com.digitalpebble.stormcrawler.parse.filter.CollectionTagger",
             "params": {
                 "file": "collections.json"
             }
         }
     }
  }
 
The resource file can be pushed to OpenSearch with
  curl -XPUT "$OSHOST/config/_create/collections.json" -H 'Content-Type: application/json' -d @src/main/resources/collections.json
 
  • Constructor Details

    • JSONResourceWrapper

      public JSONResourceWrapper()
  • Method Details