Class 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)
      Create IngestClient instance
      static IngestClient create​(java.lang.String host, int port, Options opts)
      Create IngestClient instance
      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.
      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 synchronously Rpc.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 synchronously Rpc.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 synchronously Rpc.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 synchronously Rpc.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 synchronously Rpc.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 entity
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

        public static IngestClient create​(java.lang.String host,
                                          int port)
        Create IngestClient instance
        Parameters:
        host - of the ingest server
        port - of the ingest server
        Returns:
        ingest client
      • create

        public static IngestClient create​(java.lang.String host,
                                          int port,
                                          Options opts)
        Create IngestClient instance
        Parameters:
        host - of the ingest server
        port - of the ingest server
        opts - 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 data
        statusConsumer - 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 data
        timeout - timeout
        unit - time unit of timeout
        statusConsumer - 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 value
        stamp - 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 synchronously Rpc.GetRequest to retrieve data from the system.
        Parameters:
        request - Instance of Rpc.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 synchronously Rpc.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 synchronously Rpc.ListRequest to retrieve attributes for entity.
        Parameters:
        request - Instance of Rpc.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 synchronously Rpc.ListRequest to retrieve attributes for entity.
        Parameters:
        entity - entity name
        key - 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 synchronously Rpc.ListRequest to retrieve attributes for entity.
        Parameters:
        entity - entity name
        key - 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 scan
        attributes - list of attributes
        consumer - received of results
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable