Class AbstractReceiverClient

  • Direct Known Subclasses:
    MessageForwardingClient

    public abstract class AbstractReceiverClient
    extends java.lang.Object
    Serves as the base class for all client implementations.
    • Field Detail

      • log

        protected AttivioLogger log
        Logger for all implementations.
    • Constructor Detail

      • AbstractReceiverClient

        protected AbstractReceiverClient​(java.util.UUID clientId,
                                         java.lang.String receiverUri)
        Constructor that reuses a clientId.

        This method is for very specific use cases and should not be used for general development purposes.

      • AbstractReceiverClient

        protected AbstractReceiverClient​(java.lang.String receiverUri)
        Create a client based on a specific recieverUri.
    • Method Detail

      • getClientId

        public final java.util.UUID getClientId()
        Returns:
        the client id associated with this client
      • getReceiverUri

        public final java.lang.String getReceiverUri()
        Returns:
        the receiver URI associated with this client
      • getClientWorkflow

        public WorkflowQueue getClientWorkflow()
        Returns:
        the default client workflows to use for this client.
      • setClientWorkflow

        public void setClientWorkflow​(WorkflowQueue clientWorkflow)
        Sets the default client workflows to use for this client. All future requests not explicitly setting a WorkflowQueue will use the default.
        Parameters:
        clientWorkflow - workflow queue name
      • setClientWorkflow

        public void setClientWorkflow​(java.lang.String... wfs)
        Sets the default client workflows to use for this client. All future requests not explicitly setting a WorkflowQueue will use the default.
        Parameters:
        wfs - list of workflow names
      • setConnectionCredentials

        public void setConnectionCredentials​(java.lang.String username,
                                             java.lang.String password)
        Sets the username and password for the transport connection if authentication is required.
        Parameters:
        username - user name
        password - password
      • isReceiverSSL

        protected boolean isReceiverSSL()
        Check if the receiver uri is an https connection string.
      • clearConnectionCredentials

        public void clearConnectionCredentials()
        Clear any connection credentials set for the client
      • sendMessage

        protected PlatformMessage sendMessage​(PlatformMessage msg)
                                       throws AttivioException
        Sends a synchronous message to Attivio via the configured node getReceiverUri().

        If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.

        Parameters:
        msg - the message to send
        Returns:
        the response message
        Throws:
        AttivioException
      • sendMessage

        protected PlatformMessage sendMessage​(PlatformMessage msg,
                                              boolean allowNullResponse)
                                       throws AttivioException
        Sends a synchronous message to Attivio via the configured node getReceiverUri().

        If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.

        Parameters:
        msg - the message to send
        allowNullResponse - if true, null response is acceptable
        Returns:
        the response message
        Throws:
        AttivioException
      • handleServerReset

        protected PlatformMessage handleServerReset​(PlatformMessage msg,
                                                    AttivioException ae)
                                             throws AttivioException
        Called when the client has detected a server reset. The default behavior is for the client to reset the message ids in use and continue. If the desire is to halt client-side processing in the case of a server reset, this method may be overridden to throw the supplied (ae ) exception.
        Parameters:
        msg - the message being sent
        ae - the exception generated by the server
        Returns:
        the msg that should be sent instead of the original
        Throws:
        AttivioException
      • sendAsyncMessage

        protected void sendAsyncMessage​(PlatformMessage msg)
                                 throws AttivioException
        Sends an asynchronous message to Attivio via the configured node getReceiverUri(). If the receiver uri is a local in-memory queue, ClassNotFoundExceptions will occur if the full Attivio jars are not available.
        Parameters:
        msg - the message to send
        Throws:
        AttivioException