Package ai.vespa.feed.client
Class JsonFeeder
- java.lang.Object
-
- ai.vespa.feed.client.JsonFeeder
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class JsonFeeder extends java.lang.Object implements java.io.Closeable
- Author:
- jonmv, bjorncs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonFeeder.Builder
static interface
JsonFeeder.ResultCallback
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsonFeeder.Builder
builder(FeedClient client)
void
close()
java.util.concurrent.CompletableFuture<java.lang.Void>
feedMany(java.io.InputStream jsonStream)
Same asfeedMany(InputStream, ResultCallback)
, but without a providedJsonFeeder.ResultCallback
instance.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 formjava.util.concurrent.CompletableFuture<Result>
feedSingle(java.lang.String json)
Feeds single JSON feed operations on the form
-
-
-
Method Detail
-
builder
public static JsonFeeder.Builder builder(FeedClient client)
-
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 ofFeedException
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 ofFeedException
or one of its sub-classes.
-
feedMany
public java.util.concurrent.CompletableFuture<java.lang.Void> feedMany(java.io.InputStream jsonStream)
Same asfeedMany(InputStream, ResultCallback)
, but without a providedJsonFeeder.ResultCallback
instance.- See Also:
for details.
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-