Class IncomingMessageContext

java.lang.Object
com.levigo.jadice.web.transport.server.messaging.IncomingMessageContext

public class IncomingMessageContext extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Marks the conversation as done and cleans up references, essentially disabling cancellation of this conversation.
    Builds the transport invocation context.
    void
    reply(String messageName, Object payload)
    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.
    sendFail(String operationName, Throwable t)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IncomingMessageContext

      public IncomingMessageContext()
  • Method Details

    • reply

      public void reply(String messageName, Object payload) throws Exception
      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

      public TransportInvocationContext 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

      public void sendSuccess() throws Exception
      Sends a message to the client that terminates this conversation and indicates that the requested operation was carried out successfully.
      Throws:
      Exception
    • sendFail

      public void sendFail(Throwable t)
      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

      public String sendFail(String operationName, Throwable t)
      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 null
      metadata - Any further context data for processing the end of conversation on the client side. Null most of the time.
      Throws:
      Exception