public static MessageType of(Object message) {
    if (message instanceof WatermarkMessage) {
      return WATERMARK;
    } else if (message instanceof EndOfStreamMessage) {
      return END_OF_STREAM;
    } else if (message instanceof DrainMessage) {
      return DRAIN;
    } else {
      return USER_MESSAGE;
    }
  }
Returns the {@link MessageType} of a particular intermediate stream message.
@param message an intermediate stream message
@return type of the message
samza-api/src/main/java/org/apache/samza/system/MessageType.java