Package org.copperengine.core
Class Response<E>
- java.lang.Object
-
- org.copperengine.core.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 Summary
Constructors Constructor Description Response(java.lang.String correlationId)
Creates a new instance with timeout set to true.Response(java.lang.String correlationId, E response, java.lang.Exception exception)
Creates a new instance.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCorrelationId()
Return the correlation id of this response.java.lang.Exception
getException()
java.lang.Long
getInternalProcessingTimeout()
java.lang.String
getMetaData()
E
getResponse()
java.lang.String
getResponseId()
java.lang.Long
getSequenceId()
boolean
isEarlyResponseHandling()
boolean
isTimeout()
void
setEarlyResponseHandling(boolean earlyResponseHandling)
void
setResponseId(java.lang.String responseId)
void
setSequenceId(java.lang.Long sequenceId)
java.lang.String
toString()
-
-
-
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 reachedmetaData
- Might hold some more arbitrary meta data. Usually is just null.internalProcessingTimeout
- timeout in msecresponseId
- unique id of the response. Each response must be unique of course.
-
Response
public Response(java.lang.String correlationId, E response, java.lang.Exception exception)
Creates a new instance.- Parameters:
correlationId
-Response(String, Object, Exception, boolean, String, Long, String)
response
-Response(String, Object, Exception, boolean, String, Long, String)
exception
-Response(String, Object, Exception, boolean, String, Long, String)
-
Response
public Response(java.lang.String correlationId)
Creates a new instance with timeout set to true.- Parameters:
correlationId
-Response(String, Object, Exception, boolean, String, Long, String)
-
-
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 classjava.lang.Object
-
-