Fórumok

Import 60.000 users

Gabriel BZ, módosítva 13 év-val korábban

Import 60.000 users

New Member Bejegyzések: 8 Csatlakozás dátuma: 2010.03.09. Legújabb bejegyzések
Hi,

I need to imnport about 60.000 users from excel. I saw is possible by web service (tunnel-web/axis), but the performance (with SOAP) may not be good.

I know insert directly in database strategy may infer in data consistency cause relations and lucene index will be affected.

What better solution in this case?

thanks!
Eliseu Rocha, módosítva 13 év-val korábban

RE: Import 60.000 users

New Member Bejegyzések: 3 Csatlakozás dátuma: 2010.11.03. Legújabb bejegyzések
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha
Gabriel BZ, módosítva 13 év-val korábban

RE: Import 60.000 users

New Member Bejegyzések: 8 Csatlakozás dátuma: 2010.03.09. Legújabb bejegyzések
Hi Eliseu, thanks for reply,

I can do this, i will make a test, but I'm not sure about performance, there are too many users!

[]'s
thumbnail
Peter Shin, módosítva 13 év-val korábban

RE: Import 60.000 users

Regular Member Bejegyzések: 121 Csatlakozás dátuma: 2007.09.24. Legújabb bejegyzések
regarding performance, this may speed things up a lil

BatchSessionUtil.setEnabled(true);

try {
	// your code here
}
finally {
	BatchSessionUtil.setEnabled(false);
}
Gabriel BZ, módosítva 13 év-val korábban

RE: Import 60.000 users

New Member Bejegyzések: 8 Csatlakozás dátuma: 2010.03.09. Legújabb bejegyzések
Thanks Peter,

I have imported 40.000 users (120.000 records in database, considering tables contact_, group_ e user_) in 2 hours. I think performance was very good.

[]'s
thumbnail
Ahmed Hasan, módosítva 10 év-val korábban

RE: Import 60.000 users

Expert Bejegyzések: 306 Csatlakozás dátuma: 2007.04.13. Legújabb bejegyzések
Hi Gabriel,

I am sure you've gone with the WS approach. I liked the portlet approach as it will greatly improve the performance. But since this is a one time activity, you should go ahead writing a simple java program that does this by iterating thru the records of the excel sheet and uploading the user by invoking the web service.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
thumbnail
technology evangelist, módosítva 10 év-val korábban

RE: Import 60.000 users

Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2013.08.02. Legújabb bejegyzések
Eliseu Rocha:
Have u considered develop a portlet, that uploads your file (xls), and create the user using UserLocalServiceUtil (Liferay API)

The main code (of this aproach) is something like this:

- read csv(xls) to a variable reader (Class CsvReader or something else...)
- then execute this code...

User userToCreate = UserLocalServiceUtil.createUser(userId)

...
userToCreate.setEmailAddress(reader.get("email"));
userToCreate.setPassword(reader.get("pass"));
userToCreate.setScreenName(reader.get("ScreenName"));
userToCreate.setActive(true);
...

try {

User createdUser = UserLocalServiceUtil.addUser(userToCreate);

}
catch(Exception ex)
{
//
}


If this is viable to you, tell me something, i can give u some more details.

Regards,

Eliseu Rocha



HI Eliseu Rocha,
Check Below forum post and give suggestion to clear my task

https://www.liferay.com/community/forums/-/message_boards/message/15591927