Package cz.o2.proxima.direct.client
Class IngestClient
- java.lang.Object
-
- cz.o2.proxima.direct.client.IngestClient
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class IngestClient extends java.lang.Object implements java.lang.AutoCloseable
A client being able to connect and write requests to the ingest gateway.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static IngestClient
create(java.lang.String host, int port)
CreateIngestClient
instancestatic IngestClient
create(java.lang.String host, int port, Options opts)
CreateIngestClient
instancevoid
delete(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, long stamp, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.void
delete(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.void
delete(java.lang.String key, java.lang.String entity, java.lang.String attribute, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetResponse
get(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetRequest request)
Sends synchronouslyRpc.GetRequest
to retrieve data from the system.cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetResponse
get(java.lang.String entity, java.lang.String key, java.lang.String attribute)
Sends synchronouslyRpc.GetRequest
to retrieve data from system.void
ingest(java.lang.String key, java.lang.String entity, java.lang.String attribute, com.google.protobuf.ByteString value, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.void
ingest(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, com.google.protobuf.ByteString value, long stamp, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.void
ingest(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, com.google.protobuf.ByteString value, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse
listAttributes(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListRequest request)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse
listAttributes(java.lang.String entity, java.lang.String key)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse
listAttributes(java.lang.String entity, java.lang.String key, java.lang.String offset, int limit)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.void
scanAttributes(java.lang.String entity, java.util.List<java.lang.String> attributes, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ScanResult> consumer)
Scan through attributes of an entityvoid
send(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Ingest ingest, long timeout, java.util.concurrent.TimeUnit unit, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send the request with timeout.void
send(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Ingest ingest, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send the request.
-
-
-
Method Detail
-
create
public static IngestClient create(java.lang.String host, int port)
CreateIngestClient
instance- Parameters:
host
- of the ingest serverport
- of the ingest server- Returns:
- ingest client
-
create
public static IngestClient create(java.lang.String host, int port, Options opts)
CreateIngestClient
instance- Parameters:
host
- of the ingest serverport
- of the ingest serveropts
- extra settings- Returns:
- ingest client
-
send
public void send(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Ingest ingest, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send the request.- Parameters:
ingest
- the datastatusConsumer
- callback for receiving status
-
send
public void send(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Ingest ingest, long timeout, java.util.concurrent.TimeUnit unit, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send the request with timeout.- Parameters:
ingest
- the datatimeout
- timeoutunit
- time unit of timeoutstatusConsumer
- callback for receiving status
-
ingest
public void ingest(java.lang.String key, java.lang.String entity, java.lang.String attribute, com.google.protobuf.ByteString value, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.- Parameters:
key
- entity key value.entity
- entity name.attribute
- attribute name.value
- ingested value.statusConsumer
- callback for receiving status.
-
ingest
public void ingest(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, com.google.protobuf.ByteString value, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.- Parameters:
uuid
- request UUID.key
- entity key value.entity
- entity name.attribute
- attribute name.value
- ingested value.statusConsumer
- callback for receiving status.
-
ingest
public void ingest(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, @Nullable com.google.protobuf.ByteString value, long stamp, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send ingest request.- Parameters:
uuid
- request UUID.key
- entity key value.entity
- entity name.attribute
- attribute name.value
- attribute valuestamp
- timestamp.statusConsumer
- callback for receiving status.
-
delete
public void delete(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, long stamp, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.- Parameters:
uuid
- request UUID.key
- entity key value.entity
- entity name.attribute
- attribute name.stamp
- timestamp.statusConsumer
- callback for receiving status.
-
delete
public void delete(java.lang.String key, java.lang.String entity, java.lang.String attribute, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.- Parameters:
key
- entity key value.entity
- entity name.attribute
- attribute name.statusConsumer
- callback for receiving status.
-
delete
public void delete(java.lang.String uuid, java.lang.String key, java.lang.String entity, java.lang.String attribute, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.Status> statusConsumer)
Send delete request.- Parameters:
uuid
- request UUID.key
- entity key value.entity
- entity name.attribute
- attribute name.statusConsumer
- callback for receiving status.
-
get
public cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetResponse get(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetRequest request)
Sends synchronouslyRpc.GetRequest
to retrieve data from the system.- Parameters:
request
- Instance ofRpc.GetRequest
.- Returns:
- Instance of
Rpc.GetResponse
.
-
get
public cz.o2.proxima.direct.server.rpc.proto.service.Rpc.GetResponse get(java.lang.String entity, java.lang.String key, java.lang.String attribute)
Sends synchronouslyRpc.GetRequest
to retrieve data from system.- Parameters:
entity
- entity name.key
- entity key.attribute
- attribute name.- Returns:
- Instance of
Rpc.GetResponse
.
-
listAttributes
public cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse listAttributes(cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListRequest request)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.- Parameters:
request
- Instance ofRpc.ListRequest
.- Returns:
- Instance of
Rpc.ListResponse
.
-
listAttributes
public cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse listAttributes(java.lang.String entity, java.lang.String key)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.- Parameters:
entity
- entity namekey
- entity key value.- Returns:
- Instance of
Rpc.ListResponse
.
-
listAttributes
public cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ListResponse listAttributes(java.lang.String entity, java.lang.String key, @Nullable java.lang.String offset, int limit)
Send synchronouslyRpc.ListRequest
to retrieve attributes for entity.- Parameters:
entity
- entity namekey
- entity key value.offset
- random offset.limit
- limit of values (-1 for all).- Returns:
- Instance of
Rpc.ListResponse
.
-
scanAttributes
public void scanAttributes(java.lang.String entity, java.util.List<java.lang.String> attributes, java.util.function.Consumer<cz.o2.proxima.direct.server.rpc.proto.service.Rpc.ScanResult> consumer)
Scan through attributes of an entity- Parameters:
entity
- entity to scanattributes
- list of attributesconsumer
- received of results
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-