掲示板

Import 60.000 users

13年前 に Gabriel BZ によって更新されました。

Import 60.000 users

New Member 投稿: 8 参加年月日: 10/03/09 最新の投稿
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!
13年前 に Eliseu Rocha によって更新されました。

RE: Import 60.000 users

New Member 投稿: 3 参加年月日: 10/11/03 最新の投稿
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
13年前 に Gabriel BZ によって更新されました。

RE: Import 60.000 users

New Member 投稿: 8 参加年月日: 10/03/09 最新の投稿
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
13年前 に Peter Shin によって更新されました。

RE: Import 60.000 users

Regular Member 投稿: 121 参加年月日: 07/09/24 最新の投稿
regarding performance, this may speed things up a lil

BatchSessionUtil.setEnabled(true);

try {
	// your code here
}
finally {
	BatchSessionUtil.setEnabled(false);
}
13年前 に Gabriel BZ によって更新されました。

RE: Import 60.000 users

New Member 投稿: 8 参加年月日: 10/03/09 最新の投稿
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
10年前 に Ahmed Hasan によって更新されました。

RE: Import 60.000 users

Expert 投稿: 306 参加年月日: 07/04/13 最新の投稿
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
10年前 に technology evangelist によって更新されました。

RE: Import 60.000 users

Junior Member 投稿: 35 参加年月日: 13/08/02 最新の投稿
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