Class JsonFeeder

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class JsonFeeder
    extends java.lang.Object
    implements java.io.Closeable
    Author:
    jonmv, bjorncs
    • Method Detail

      • feedSingle

        public java.util.concurrent.CompletableFuture<Result> feedSingle​(java.lang.String json)
        Feeds single JSON feed operations on the form
            {
              "id": "id:ns:type::boo",
              "fields": { ... document fields ... }
            }
          
        Exceptional completion will use be an instance of FeedException or one of its sub-classes.
      • feedMany

        public java.util.concurrent.CompletableFuture<java.lang.Void> feedMany​(java.io.InputStream jsonStream,
                                                                               JsonFeeder.ResultCallback resultCallback)
        Feeds a stream containing a JSON array of feed operations on the form
             [
               {
                 "id": "id:ns:type::boo",
                 "fields": { ... document fields ... }
               },
               {
                 "put": "id:ns:type::foo",
                 "fields": { ... document fields ... }
               },
               {
                 "update": "id:ns:type:n=4:bar",
                 "create": true,
                 "fields": { ... partial update fields ... }
               },
               {
                 "remove": "id:ns:type:g=foo:bar",
                 "condition": "type.baz = \"bax\""
               },
               ...
             ]
         
        Note that "id" is an alias for the document put operation. Exceptional completion will use be an instance of FeedException or one of its sub-classes.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException