Class IncomingMessageContext
java.lang.Object
com.levigo.jadice.web.transport.server.messaging.IncomingMessageContext
This object provides some context information relating to a message, as well as actions the consumer can perform
in direct relation to the ingoing message.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
done()
Marks the conversation as done and cleans up references, essentially disabling cancellation of this conversation.Builds the transport invocation context.void
Send a message to the client in response to the current conversation.void
sendEOC
(boolean success, String errorMessage, com.fasterxml.jackson.databind.node.ObjectNode metadata) Sends a message to the client that terminates this conversation.Sends a message to the client that terminates this conversation and indicates that the requested operation was not carried out properly.void
Sends a message to the client that terminates this conversation and indicates that the requested operation was not carried out properly.void
Sends a message to the client that terminates this conversation and indicates that the requested operation was carried out successfully.
-
Constructor Details
-
IncomingMessageContext
public IncomingMessageContext()
-
-
Method Details
-
reply
Send a message to the client in response to the current conversation.- Parameters:
messageName
- Identifies the type of response.payload
- The payload. Should be a non-primitive, non-null object.- Throws:
Exception
-
done
public void done()Marks the conversation as done and cleans up references, essentially disabling cancellation of this conversation. Also called automatically whenever an end-of-conversation is sent using the default methods. -
makeTransportInvocationContext
Builds the transport invocation context. This is still used by our services for the time being, but could be replaced in the future. -
sendSuccess
Sends a message to the client that terminates this conversation and indicates that the requested operation was carried out successfully.- Throws:
Exception
-
sendFail
Sends a message to the client that terminates this conversation and indicates that the requested operation was not carried out properly.- Parameters:
t
- Any exception that happened during processing.
-
sendFail
Sends a message to the client that terminates this conversation and indicates that the requested operation was not carried out properly.- Parameters:
operationName
- Contextual description of what went wrong for logging on the client side.t
- Any exception that happened during processing.
-
sendEOC
public void sendEOC(boolean success, String errorMessage, com.fasterxml.jackson.databind.node.ObjectNode metadata) throws Exception Sends a message to the client that terminates this conversation.- Parameters:
success
- Was the requested operation carried out successfully?.errorMessage
- If there was an error, supply the error message, otherwise nullmetadata
- Any further context data for processing the end of conversation on the client side. Null most of the time.- Throws:
Exception
-