Foros de discusión

How to schedule

Dhanush B, modificado hace 9 años.

How to schedule

Junior Member Mensajes: 56 Fecha de incorporación: 26/08/14 Mensajes recientes
Hi Friends,
i have created custom portlet using that i have uploaded video to database, now i want to give time scheduling option to user, using that user can able to schedule their song on particular day or month or time or dayof week i am new to this task so please friends share your ideas.

i am using life ray 6.1 and tomcat 7.

Thanks and Regards
Dhanush
thumbnail
Prakash Khanchandani, modificado hace 9 años.

RE: How to schedule

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
Dhanush B:
... user can able to schedule their song on particular day or month ...


I am not sure what do you mean by this. Can you give some details or elaborate as to what should happen after the scheduled time is reached like Should the video start playing automatically for the User? should the video be displayed when the user navigates to the page this portlet on the scheduled time and not before that? An email should go during the scheduled time? Or A notification appears for the user to play the video?

Thanks,
Prakash
Dhanush B, modificado hace 9 años.

RE: How to schedule

Junior Member Mensajes: 56 Fecha de incorporación: 26/08/14 Mensajes recientes
Hi prakash,
Exactly your correct, when user navigate to this page in my portlet, on the scheduled time video should be there with immediate play option and at the same time i want to sent notification mail before 6 hours of scheduled time to user mailId.

Thanks,
Dhanush
thumbnail
Prakash Khanchandani, modificado hace 9 años.

RE: How to schedule

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
Liferay has similar functionality in Blogs (display-date), Web-content (schedule-content), Calendar (event reminders) etc.

Email notification
I am giving an example as to how you can send the email notification by taking example from Liferay's Calendar-portlet.

You can check calendar portlet's liferay-portlet.xml and search for an entry like:

<scheduler-entry>
    <scheduler-event-listener-class>com.liferay.calendar.messaging.CheckBookingsMessageListener</scheduler-event-listener-class>
    <trigger>
        <simple>
            <property-key>calendar.notification.check.interval</property-key>
            <time-unit>minute</time-unit> <!-- this can be second, minute, day etc -->
        </simple>
    </trigger>
</scheduler-entry>


What this does is it will the run the code in CheckBookingsMessageListener after so many minutes as specified for property "calendar.notification.check.interval" in portlet.properties. So if the value specified in portlet.properties is:

calendar.notification.check.interval=2


Then the method doReceive() in CheckBookingsMessageListener (as shown below) will run every 2 minutes:

public class CheckBookingsMessageListener extends BaseMessageListener {
	protected void doReceive(Message message) throws Exception {
		CalendarBookingLocalServiceUtil.checkCalendarBookings();
	}
}


You would need to implement a custom listener like this as shown above.

Now you can write your code logic inside this method to fetch all those videos for the different users whose displayDate (set by the User from the portlet) is going to come in next 6 hrs and after fetching you can send the notification.

Displaying the content on scheduled time when user comes on the page
There are two ways:
  • Similar to Liferay's Blogs portlet, just fetch those media items in the portlet whose displayDate is reached.
  • Using the above notification mechanism, set a certain flag value for the media items in the DB whose displayDate is reached and then show only the items for which the flag is set to that value


Hope this makes sense and I hope I have understood what is required.
Dhanush B, modificado hace 9 años.

RE: How to schedule

Junior Member Mensajes: 56 Fecha de incorporación: 26/08/14 Mensajes recientes
Hi prakash,
Exactly you got my requirement and you shared most useful information for scheduling ya really this is helpful now i got some idea from this i will try if i will get any issue i will post new thread.
Thanks and Regards
B.dhanushemoticon
Nandakumaran Kasinathan, modificado hace 8 años.

RE: How to schedule

New Member Mensajes: 12 Fecha de incorporación: 16/04/15 Mensajes recientes
Hi,
I am new to liferay and using 6.2. I have downloaded developer studio and have created a new MVC portlet, which calls a java file that will import xml files into media and document section from my local drive.

I wanted to schedule the file import so it automatically checks and imports (like every 5 minutes). I have the liferay-portlet.xml file and when I tried to add the <scheduler-entry> section, I get and error message that this is not a valid tag for this file. I did not find any of the specified example that you have specified to check on how to add <scheduler-entry> section in liferay-portlet.xml.

Can please provide more information on this to get this configured.