Class StreamedResponseClient

    • Constructor Detail

      • StreamedResponseClient

        public StreamedResponseClient​(StreamRequestInfo config,
                                      java.io.InputStream input)
        Internal Use Only
    • Method Detail

      • bytesRead

        public long bytesRead()
        Get the number of bytes read during streaming request.

        NOTE: Returns -1 if this could not be determined.

      • getDocuments

        public java.lang.Iterable<SearchDocument> getDocuments()
                                                        throws java.io.IOException
        Get the response documents.

        This method will throw an exception if documents are not yet available, or were not requested.

        Specified by:
        getDocuments in interface StreamingQueryResponse
        Throws:
        java.io.IOException
      • getDocumentIds

        public java.lang.Iterable<java.lang.String> getDocumentIds()
                                                            throws java.io.IOException
        Get the response document ids.

        This method will throw an exception if document ids are not yet available, or were not requested.

        Specified by:
        getDocumentIds in interface StreamingQueryResponse
        Throws:
        java.io.IOException
      • getFacets

        public java.lang.Iterable<StreamingFacetResponse> getFacets()
                                                             throws java.io.IOException
        Get the facets.

        This method will throw an exception if facets are not yet available, or were not requested.

        Specified by:
        getFacets in interface StreamingQueryResponse
        Throws:
        java.io.IOException
      • getQueryResponse

        public QueryResponse getQueryResponse()
                                       throws java.io.IOException,
                                              AttivioException
        Get the QueryResponse for the query.

        This method will throw an exception if the query response is not yet available, or if the query execution resulted in an exception.

        NOTE: this method may return null if stream was closed prematurely.

        Specified by:
        getQueryResponse in interface StreamingQueryResponse
        Throws:
        java.io.IOException
        AttivioException
      • receive

        protected java.lang.Object receive()
        Read the next element from the response stream.

        Returns null on boundary.

      • close

        public void close()
                   throws java.io.IOException
        Closes the streaming connection.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface StreamingQueryResponse
        Throws:
        java.io.IOException
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • cancel

        public void cancel()
                    throws java.io.IOException
        Force disconnect the client connection. Ignores thread guards on purpose.
        Specified by:
        cancel in interface StreamingQueryResponse
        Throws:
        java.io.IOException
      • createStreamedResponseClient

        public static final StreamedResponseClient createStreamedResponseClient​(java.lang.String clientWorkflow,
                                                                                java.lang.String queryEndpoint,
                                                                                QueryRequest request,
                                                                                StreamRequestInfo streamConfig)
                                                                         throws AttivioException
        Create a new streamed response client.

        This will move into SearchClient eventually but is left here for better separation during development.

        Throws:
        AttivioException