Class Response<E>

  • Type Parameters:
    E - type of data held by the response for the user/workflow.
    All Implemented Interfaces:
    java.io.Serializable

    public class Response<E>
    extends java.lang.Object
    implements java.io.Serializable
    Container for asynchronous responses.
    See Also:
    Serialized Form
    • Constructor Detail

      • Response

        public Response​(java.lang.String correlationId,
                        E response,
                        java.lang.Exception exception,
                        boolean isTimeout,
                        java.lang.String metaData,
                        java.lang.Long internalProcessingTimeout,
                        java.lang.String responseId)
        Constructor.
        Parameters:
        correlationId - the correlation ID on which a workflow is or will hopefully be waiting. This is kind of the mapping between notification from outside and the workflow inside COPPER.
        response - data which shall be passed to the workflow with the response when the workflow continues execution.
        exception - Might be set if an exception occurred. So the workflow can query the Response and will know if an error somewhere happened.
        isTimeout - holds information whether this response was automatically generated from COPPER as a dummy holder to notify the workflow that there was no "real" response but the specified timeout was reached
        metaData - Might hold some more arbitrary meta data. Usually is just null.
        internalProcessingTimeout - timeout in msec
        responseId - unique id of the response. Each response must be unique of course.
    • Method Detail

      • getCorrelationId

        public java.lang.String getCorrelationId()
        Return the correlation id of this response.
        Returns:
        the correlation id of this response
      • getResponse

        public E getResponse()
        Returns:
        the response object
      • getException

        public java.lang.Exception getException()
        Returns:
        the exception or null if no exception occured
      • isTimeout

        public boolean isTimeout()
        Returns:
        true, if a timeout occured while waiting for the response.
      • getInternalProcessingTimeout

        public java.lang.Long getInternalProcessingTimeout()
        Returns:
        Timeout in milliseconds
      • getMetaData

        public java.lang.String getMetaData()
        Returns:
        the meta data of this response. Not used by the copper core itself. Applications may use this data for monitoring or some custom response handling.
      • setEarlyResponseHandling

        public void setEarlyResponseHandling​(boolean earlyResponseHandling)
      • isEarlyResponseHandling

        public boolean isEarlyResponseHandling()
        Returns:
        if response is held in early response handling. If true, a response is queued temporarily in the 'early response container' if currently no workflow instance is (yet) waiting for the responses' correlationId.
      • getResponseId

        public java.lang.String getResponseId()
      • setResponseId

        public void setResponseId​(java.lang.String responseId)
      • getSequenceId

        public java.lang.Long getSequenceId()
      • setSequenceId

        public void setSequenceId​(java.lang.Long sequenceId)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object