Foros de discusión

Import 60.000 users

Gabriel BZ, modificado hace 13 años.

Import 60.000 users

New Member Mensajes: 8 Fecha de incorporación: 9/03/10 Mensajes recientes
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, modificado hace 13 años.

RE: Import 60.000 users

New Member Mensajes: 3 Fecha de incorporación: 3/11/10 Mensajes recientes
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, modificado hace 13 años.

RE: Import 60.000 users

New Member Mensajes: 8 Fecha de incorporación: 9/03/10 Mensajes recientes
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, modificado hace 13 años.

RE: Import 60.000 users

Regular Member Mensajes: 121 Fecha de incorporación: 24/09/07 Mensajes recientes
regarding performance, this may speed things up a lil

BatchSessionUtil.setEnabled(true);

try {
	// your code here
}
finally {
	BatchSessionUtil.setEnabled(false);
}
Gabriel BZ, modificado hace 13 años.

RE: Import 60.000 users

New Member Mensajes: 8 Fecha de incorporación: 9/03/10 Mensajes recientes
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, modificado hace 10 años.

RE: Import 60.000 users

Expert Mensajes: 306 Fecha de incorporación: 13/04/07 Mensajes recientes
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, modificado hace 10 años.

RE: Import 60.000 users

Junior Member Mensajes: 35 Fecha de incorporación: 2/08/13 Mensajes recientes
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