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 ES. 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 ES 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": "ESCollectionTagger",
         "params": {
             "refresh": "60",
             "delegate": {
                 "class": "com.digitalpebble.stormcrawler.parse.filter.CollectionTagger",
                 "params": {
                     "file": "collections.json"
                 }
             }
         }
      }
     
    The resource file can be pushed to ES with
      curl -XPUT "$ESHOST/config/_create/collections.json" -H 'Content-Type: application/json' -d @src/main/resources/collections.json
     
    • Constructor Detail

      • JSONResourceWrapper

        public JSONResourceWrapper()