public EventMessage getEventMessage(String eventTypeString, String messageBody) {

    switch (EventMessage.EventType.valueOf(eventTypeString)) {
    case CREATE_DATABASE:
      return getCreateDatabaseMessage(messageBody);
    case ALTER_DATABASE:
      return getAlterDatabaseMessage(messageBody);
    case DROP_DATABASE:
      return getDropDatabaseMessage(messageBody);
    case CREATE_TABLE:
      return getCreateTableMessage(messageBody);
    case ALTER_TABLE:
      return getAlterTableMessage(messageBody);
    case DROP_TABLE:
      return getDropTableMessage(messageBody);
    case ADD_PARTITION:
      return getAddPartitionMessage(messageBody);
    case ALTER_PARTITION:
      return getAlterPartitionMessage(messageBody);
    case DROP_PARTITION:
      return getDropPartitionMessage(messageBody);
    case CREATE_FUNCTION:
      return getCreateFunctionMessage(messageBody);
    case DROP_FUNCTION:
      return getDropFunctionMessage(messageBody);
    case INSERT:
      return getInsertMessage(messageBody);
    case ADD_PRIMARYKEY:
      return getAddPrimaryKeyMessage(messageBody);
    case ADD_FOREIGNKEY:
      return getAddForeignKeyMessage(messageBody);
    case ADD_UNIQUECONSTRAINT:
      return getAddUniqueConstraintMessage(messageBody);
    case ADD_NOTNULLCONSTRAINT:
      return getAddNotNullConstraintMessage(messageBody);
    case ADD_DEFAULTCONSTRAINT:
      return getAddDefaultConstraintMessage(messageBody);
    case ADD_CHECKCONSTRAINT:
      return getAddCheckConstraintMessage(messageBody);
    case DROP_CONSTRAINT:
      return getDropConstraintMessage(messageBody);
    case OPEN_TXN:
      return getOpenTxnMessage(messageBody);
    case COMMIT_TXN:
      return getCommitTxnMessage(messageBody);
    case ABORT_TXN:
      return getAbortTxnMessage(messageBody);
    case ALLOC_WRITE_ID:
      return getAllocWriteIdMessage(messageBody);
    case ACID_WRITE:
      return getAcidWriteMessage(messageBody);
    case UPDATE_TABLE_COLUMN_STAT:
      return getUpdateTableColumnStatMessage(messageBody);
    case DELETE_TABLE_COLUMN_STAT:
      return getDeleteTableColumnStatMessage(messageBody);
    case UPDATE_PARTITION_COLUMN_STAT:
      return getUpdatePartitionColumnStatMessage(messageBody);
    case DELETE_PARTITION_COLUMN_STAT:
      return getDeletePartitionColumnStatMessage(messageBody);
    case COMMIT_COMPACTION:
      return getCommitCompactionMessage(messageBody);
    default:
      throw new IllegalArgumentException("Unsupported event-type: " + eventTypeString);
    }
  }
Method to construct EventMessage from string.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/messaging/MessageDeserializer.java