Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: API using the same code as Job Scheduler doens't create/update content
Hello guys,
My situation is:
I have a scheduled job already that create/update around 1 thousand of contents. The total processing time is 5 hours.
Job calling method:
My method is like:
I did an api that I access on api/jsonws that calls the same method.
and when it is running, all the logs run, but the content itself doenst update/create (depending of the rule).
I dont have idea what's happening as I'm using the same code.
My situation is:
I have a scheduled job already that create/update around 1 thousand of contents. The total processing time is 5 hours.
Job calling method:
@Override
protected void doReceive(Message message) throws Exception {
try {
ImportContent.getInstace().init();
} catch (Exception e) {
e.printStackTrace();
}
registerScheduler();
}
My method is like:
private void init() {
//a lot of rules
JournalArticleLocalServiceUtil.updateJournalArticle(article);
}
I did an api that I access on api/jsonws that calls the same method.
and when it is running, all the logs run, but the content itself doenst update/create (depending of the rule).
public String callImportContentByJob(){
try {
ImportContent.getInstace().init();
} catch (PortalException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} catch (IOException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
return "The execution is finished.";
}
My question is: what should I do in this case. Does it has some problem If my api spend more than a specific time?I dont have idea what's happening as I'm using the same code.
I also saw that the contents only update when the service finishes its processing.
Where are you seeing it not update? is it updated in the DB?
Maybe your entire method is under one transaction?
Maybe you should call the other service method because it does other things like updates the AssetEntry and reindexes:
Maybe your entire method is under one transaction?
Maybe you should call the other service method because it does other things like updates the AssetEntry and reindexes:
@Indexable(type = IndexableType.REINDEX)
@Override
public JournalArticle updateArticle(
long userId, long groupId, long folderId, String articleId,
double version, Map<locale, string> titleMap,
Map<locale, string> descriptionMap, String content,
String ddmStructureKey, String ddmTemplateKey, String layoutUuid,
int displayDateMonth, int displayDateDay, int displayDateYear,
int displayDateHour, int displayDateMinute, int expirationDateMonth,
int expirationDateDay, int expirationDateYear,
int expirationDateHour, int expirationDateMinute,
boolean neverExpire, int reviewDateMonth, int reviewDateDay,
int reviewDateYear, int reviewDateHour, int reviewDateMinute,
boolean neverReview, boolean indexable, boolean smallImage,
String smallImageURL, File smallImageFile,
Map<string, byte[]> images, String articleURL,
ServiceContext serviceContext)
throws PortalException {</string,></locale,></locale,>
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™