예제 #1
0
  public static Message createMessage(
      CassandraClient cassandraClient,
      String appId,
      String fromUserId,
      String toUserId,
      String messageContent) {

    String messageId = IdGenerator.generateId();

    HashMap<String, String> map = new HashMap<String, String>();
    map.put(DBConstants.F_MESSAGEID, messageId);
    map.put(DBConstants.F_FROM_USERID, fromUserId);
    map.put(DBConstants.F_TO_USERID, toUserId);
    map.put(DBConstants.F_MESSAGE_CONTENT, messageContent);
    map.put(DBConstants.F_CREATE_DATE, DateUtil.currentDate());
    map.put(DBConstants.F_CREATE_SOURCE_ID, appId);
    log.info("<createMessage> messageId=" + messageId + ", fromUserId=" + fromUserId);
    cassandraClient.insert(DBConstants.MESSAGE, messageId, map);
    return new Message(map);
  }
예제 #2
0
 public static void createUserPostIndex(
     CassandraClient cassandraClient, String fromUserId, String toUserId, String messageId) {
   UUID uuid = UUID.fromString(messageId);
   cassandraClient.insert(DBConstants.INDEX_MY_MESSAGE, fromUserId, uuid, toUserId);
   cassandraClient.insert(DBConstants.INDEX_MY_MESSAGE, toUserId, uuid, fromUserId);
 }