8 Replies Latest reply: Apr 29, 2014 5:19 AM by Santanu.WCC RSS

    Custom daily event is not executing properly. Needs to require restart the UCM server

    Santanu.WCC

      Hi All,

       

      I have created a custom component of schedule event by implementing the CustomDailyEvent which will trigger monthly once.

      Please find the resource file:

      <body>

       

       

      <@table PurgingJob_IdcScheduledSystemEvents@>

      <table border=1><caption><strong>

       

       

      <tr>

        <td>action</td>

        <td>configIntervalKey</td>

        <td>allowEventScript</td>

        <td>intervalType</td>

        <td>defaultInterval</td>

        <td>eventCategory</td>

      </tr>

       

      <tr>

        <td>CustomDailyEvent</td>

        <td>CustomDailyEventInterval</td>

        <td><$include set_doevent_for_custom_daily_event_but_at_proper_time$></td>

        <td>inDays</td>

        <td>30</td>

        <td>ScheduledWork</td>

      </tr>

      </table>

       

      <@end@>

       

      <@dynamichtml set_doevent_for_custom_daily_event_but_at_proper_time@>

      <$ now= dateCurrent() $>

        <$midnight = parseDate(formatDateOnly(now) & " 09:00 AM")$>

        <$diff = toInteger(parseDate(now) - parseDate(midnight))$>

        <$if diff >= (0) and diff < (2*60*60*1000)$>

                  <$doEvent = 1$>

          <$endif$>

      <@end@>

       

      </body>

       

      Similarly I have also created the doFilter method and implemented like:

       

      public int doFilter(Workspace ws, intradoc.data.DataBinder eventData,

        ExecutionContext arg2) throws DataException, ServiceException {

       

         String action = eventData.getLocal("action");

        SystemUtils.trace(COMPONENT_DEBUG, "Action: " + action);

       

        if (action.equals("CustomDailyEvent")) {

        update("CustomDailyEvent", "event starting...", ws);

       

        myCustomJavaMethod(ws);

       

        update("CustomDailyEvent", "event finished successfully", ws);

       

          return 1;

        }

        return 0;

        }




      But I am facing issue on the job (daily event) triggering. For testing purpose, I am manually updating the activestate.hda file to one month back date and time and restart the server. The job is triggering and executing my java method but if I put the schedule date for future date like next day then it is not executing. I have tested many times and noticed that on the same day when I am giving any time for executing the job, it is happening fine. But when I am putting for future date then it is not executing.

       

      Like I have updated the activestate.hda file like:

      CustomDailyEvent

      {ts '2014-03-09 09:35:39.701'}

      Event CustomDailyEvent has finished

       

      So as per the time it should run on 9th of April 2014 at 09:35 but it daily event is not executing. As I am giving of 2 hours duration in resource file so minimum it should run at any time between 9 to 11 AM.

      But it is not executing.

      Then I modify the time in resource file to 11 AM like:

       

      <@dynamichtml set_doevent_for_custom_daily_event_but_at_proper_time@>

      <$ now= dateCurrent() $>

        <$midnight = parseDate(formatDateOnly(now) & " 11:00 AM")$>

        <$diff = toInteger(parseDate(now) - parseDate(midnight))$>

        <$if diff >= (0) and diff < (2*60*60*1000)$>

                  <$doEvent = 1$>

          <$endif$>

      <@end@>

       

       

      and restart the server then the daily event execute at 11:30.

       

      So the basic logic I have found that the server needs to be restarted on the day.

      Can anyone help me on this and resolve it because I do not want to restart the server. I have tested it many times and played around it but not able to found any issue.

       

      Santanu

       

       

       

       





        • 1. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
          Ramesh V

          Hi Santanu,

           

          Modify your java code as per below and try to test on daily basis as your testing. Now it will execute for future date also.

           

          public int doFilter(Workspace ws, intradoc.data.DataBinder eventData,

            ExecutionContext arg2) throws DataException, ServiceException {

           

               String action = eventData.getLocal("action");

               SystemUtils.trace(COMPONENT_DEBUG, "Action: " + action);

               if (action.equals("CustomDailyEvent")) {

                    update("CustomDailyEvent", "event starting...", ws);

                    myCustomJavaMethod(ws);

                    update("CustomDailyEvent", "event finished successfully", ws);

               }

            return 1;

          }


          Regards,

          Ramesh

          • 2. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
            Santanu.WCC

            Hi Ramesh,

            Still the issue is not resolved. I have tried with all the possible coding but not working.

            Even I put frequency of 2 Days but still the same issue.

             

            Each and every time restart is required.

             

            Regards,

            Santanu

            • 3. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
              Bunty

              since you set the interval in days... your job will be triggered only once after the configured period.

              I don't think you can control at what time it should run while using scheduledSystemEvents and inDays.

               

              change your <$include set_doevent_for_custom_daily_event_but_at_proper_time$> to <$doEvent=1$>. This way your job will run after configured interval (around 12AM I guess).


              when you use

              intervalType=inHours

              defaultInterval=1

              your job is triggered once every hour.

               

              if you want to run the job after x days and at specific interval..

              hook into extraAfterServicesLoadInit filter and add a scheduled job...

              how to?

              refer to OCM component at $ORACLE_HOME/ucm/idc/components/OCM

              • 4. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
                Santanu.WCC

                Hi All,

                 

                I have noticed that my event is trying to execute on time and first time execution is happening fine. But from the second time parseDate exception is coming.

                 

                checkScheduledEvents:CustomDailyEvent script error java.io.IOException: !csDynHTMLReportMsgFunction,parseDate
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.createIOException(DynamicHtmlMerger.java:2622)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:1232)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateGrammarElement(DynamicHtmlMerger.java:1059)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.substituteVariable(DynamicHtmlMerger.java:626)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.substituteVariable(DynamicHtml.java:1394)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1110)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.outputHtmlFromStart(DynamicHtml.java:1020)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.outputHtmlEx(DynamicHtml.java:1227)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.outputHtmlFromStart(DynamicHtml.java:1020)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtml.outputHtml(DynamicHtml.java:991)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.executeDynamicHtmlToWriter(DynamicHtmlMerger.java:2090)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateScriptToWriter(DynamicHtmlMerger.java:1902)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateScriptNoErrorHandling(DynamicHtmlMerger.java:1866)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateScriptEx(DynamicHtmlMerger.java:1824)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.common.DynamicHtmlMerger.evaluateScript(DynamicHtmlMerger.java:1811)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.server.ScheduledSystemEvents.checkIfShouldExecute(ScheduledSystemEvents.java:340)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.server.ScheduledSystemEvents.checkForWork(ScheduledSystemEvents.java:535)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at intradoc.server.ScheduledSystemEvents.run(ScheduledSystemEvents.java:486)
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events at java.lang.Thread.run(Thread.java:662)


                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events Caused by: intradoc.common.ServiceException: !syUnableToParseDate,2014-04-25 11:45 AM!syUnableToFindText,{ts
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events *ScriptStack !csDynHTMLStackDumpStart,<undefined>,<no path>!$
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events !csDynHTMLEvalVariableInMethod,ScheduledSystemEvents.checkIfShouldExecute,CustomDailyEvent(allowEventScript)!$
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events !csDynHTMLStackElementWithoutCallFromFilename,set_doevent_for_custom_daily_event_but_at_proper_time!$
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events !csDynHTMLErrorMessage,/d01/app/oracle/admin/wcc_domain/UCM_Cluster/cs/custom/PNCPurgingJob/resources/pncpurgingjob_resource.htm,35,15!csDynHTMLReportMsgFunction,parseDate!$
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events -> <$midnight = parseDate(formatDateOnly(now) & " 11:45 AM")$>
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events -> <$diff = toInteger(parseDate(now) - parseDate(midnight))$>
                scheduledevents/6 04.25 11:47:05.913 Scheduled System Events -> <$if diff >= (0) and diff < (2*60*60*1000)$>

                 

                Can anyone please provide some solution.

                I have seen the same issue in another discussion but no solution is there:

                scheduledSystemEvent needs to be fired once a week

                https://community.oracle.com/thread/2430690?start=0&tstart=0

                 

                This is very urgent.

                 

                Regards,

                Santanu


                • 5. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
                  Swapnil Solanki

                  Hi Santanu,

                   

                  it seems the error is happening within your custom code.

                  some dynamic includes is erroring at "d01/app/oracle/admin/wcc_domain/UCM_Cluster/cs/custom/PNCPurgingJob".

                   

                   

                  if you can share what is that you are doing there, may be a solution can be identified.

                  Also print the date value that you want to prase, so that difference between the first time and the second time values can be identified.

                   

                  cheers,

                  swapnil

                  • 6. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
                    Santanu.WCC

                    Hi,

                     

                    Please find the resource file:

                     

                    <@table PurgingJob_IdcScheduledSystemEvents@>

                    <table border=1><caption><strong>

                     

                     

                    <tr>

                      <td>action</td>

                      <td>configIntervalKey</td>

                      <td>allowEventScript</td>

                      <td>intervalType</td>

                      <td>defaultInterval</td>

                      <td>eventCategory</td>

                    </tr>

                     

                     

                    <tr>

                      <td>CustomDailyEvent</td>

                      <td>CustomDailyEventInterval</td>

                      <td><$include set_doevent_for_custom_daily_event_but_at_proper_time$></td>

                      <td>inDays</td>

                      <td>1</td>

                      <td>ScheduledWork</td>

                    </tr>

                    </table>

                    <@end@>

                    <@dynamichtml set_doevent_for_custom_daily_event_but_at_proper_time@>

                    <$ now= dateCurrent() $>

                      <$midnight = parseDate(formatDateOnly(now) & " 06:00 PM")$>

                      <$diff = toInteger(parseDate(now) - parseDate(midnight))$>

                      <$if diff >= (0) and diff < (2*60*60*1000)$>

                                <$doEvent = 1$>

                        <$endif$>

                    <@end@>

                     

                    I believe the error is coming from the below lines:

                    <$midnight = parseDate(formatDateOnly(now) & " 06:00 PM")$>

                      <$diff = toInteger(parseDate(now) - parseDate(midnight))$>

                     

                    But I am confused why this is happening. If there is some date format issue present then why it is executing first time without any error.

                    Or is there any issue in my update method from java custom code. Please find the custom code:

                     

                    public int doFilter(Workspace ws, intradoc.data.DataBinder eventData,

                      ExecutionContext arg2) throws DataException, ServiceException {

                       String action = eventData.getLocal("action");

                      SystemUtils.trace(COMPONENT_DEBUG, "Action: " + action);

                       if (action.equals("CustomDailyEvent")) {

                    myCustomJavaMethod(ws);

                        return 1;

                      }

                      return 0;

                      }

                     

                    public void myCustomJavaMethod(Workspace ws) throws DataException,

                      ServiceException {

                      update("CustomDailyEvent", "event starting...", ws);

                    my coding....

                    update("CustomDailyEvent", "event finished successfully", ws);

                     

                    }

                     

                    protected void update(String action, String msg, Workspace workspace) throws ServiceException, DataException

                      {

                          long curTime = System.currentTimeMillis();

                          ScheduledSystemEvents sse = IdcSystemLoader.getOrCreateScheduledSystemEvents(workspace);

                          sse.updateEventState(action, msg, curTime);

                      }

                     

                     

                    Regards,

                    Santanu

                    • 7. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
                      Ramesh V

                      Hi Santanu ,

                       

                      Try with the below reference code. It will execute daily @ midnight. Hope that nothing wrong in your resource code. Please check the documents expired date which are going to be Notified before scheduling the Custom Expired Notification.

                       

                      In the below resource file i am executing @ midnight 12:01 AM. Its the default time.

                       

                      --- Resource File -----

                       

                      <@table CustomExpiredScheduledEvent@>

                      <table border=1><caption><strong>CustomExpiredScheduledEvents</strong></caption>

                      <tr>

                          <td>action</td>

                          <td>configIntervalKey</td>

                          <td>allowEventScript</td>

                          <td>intervalType</td>

                          <td>defaultInterval</td>

                          <td>eventCategory</td>

                      </tr>

                       

                      <tr>

                          <td>CustomDailyExpiredEvent</td>

                          <td>CustomDailyExpiredEventInterval</td>

                          <td><$include set_doevent_for_custom_daily_expired_event$></td>

                          <td>inDays</td>

                          <td>1</td>

                          <td>ScheduledWork</td>

                      </tr>

                       

                      </table>

                      <@end@>

                       

                      <!-- this is used by the scheduled events to see if it is time to

                           call the 'CustomDailyEvent' action. The 'action' will be called

                           only if the value for 'doEvent' is set.

                       

                           This is a good place to write custom IdocScript to determine if its

                           a good idea to run the event. Good triggers include looking to see

                           if a document is in a workflow, or the time of day, or if a query

                           returns any documents.

                       

                           Since this is a daily event, which might tax the system, it will

                           only be run at about midnight.

                       

                           If you have complex IdocScript that you wish to test, you should

                           either run it in in a sample HCST, or leverage the 7.5 'trace'

                           function to log information to the console.

                      -->

                       

                      <@dynamichtml set_doevent_for_custom_daily_expired_event@>

                      <!-- determine the current time -->

                      <$now = dateCurrent()$>

                       

                      <!-- determine midnight, today -->

                      <$midnight = parseDate(formatDateOnly(now) & " 12:01 AM")$>

                       

                      <!-- the difference between now, and midnight today -->

                      <$diff = toInteger(parseDate(now) - parseDate(midnight))$>

                       

                      <!-- to be absolutely safe, and only fire this action between midnight

                           and 2AM, we will will set 'doEvent' if the difference is between

                           zero and two hours. -->

                      <$if diff > 0 and diff < (2*60*60*1000)$>

                          <$doEvent=1$>

                      <$endif$>

                      <@end@>

                       

                       

                      ----- Java Class ------

                       

                      public class ExpiredContentScheduler implements FilterImplementor {

                       

                          public int doFilter(Workspace ws, DataBinder binder, ExecutionContext cxt)

                                  throws DataException, ServiceException {

                              String action = binder.getLocal("action");

                              if (action.equals("CustomDailyExpiredEvent")) {

                                  doCustomDailyExpiredEvent(ws, binder, cxt);

                              }

                              return 1;

                          }

                       

                      public void doCustomDailyExpiredEvent(Workspace ws, DataBinder binder,

                                  ExecutionContext cxt) throws DataException, ServiceException {

                              update("CustomDailyExpiredEvent", "event starting...", ws);

                              My Coding ....

                              update("CustomDailyExpiredEvent", "event finished successfully", ws);

                          }

                       

                       

                          public void update(String action, String msg, Workspace workspace)

                                  throws ServiceException, DataException {

                              long curTime = System.currentTimeMillis();

                              ScheduledSystemEvents sse = IdcSystemLoader

                                      .getOrCreateScheduledSystemEvents(workspace);

                              sse.updateEventState(action, msg, curTime);

                          }

                       

                       

                          public String getContentType() {

                              return "text/html";

                          }

                       

                         public Workspace getSystemWorkspace() {

                              Workspace workspace = null;

                              Provider wsProvider = Providers.getProvider("SystemDatabase");

                              if (wsProvider != null)

                                  workspace = (Workspace) wsProvider.getProvider();

                              return workspace;

                          }

                       

                      }

                       

                      let me know any issues after trying this code.

                       

                      Regards,

                      Ramesh

                      • 8. Re: Custom daily event is not executing properly. Needs to require restart the UCM server
                        Santanu.WCC

                        Ramesh,

                         

                        I have already done this modification and tested but still the issue was there.

                        Secondly the issue is happening in Unix environment. In windows it's working fine.

                         

                        Regarding,

                        Santanu