Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-48234

Programatically scheduled persistent jobs are not triggered

    Details

      Description

      Description

      There is a broken API contract between QuartzSchedulerEngine and SchedulerEventMessageListenerWrapper.

      In method QuartzSchedulerEngine#getFullName() RECEIVER_KEY is build like this:

      groupName.concat(StringPool.PERIOD).concat(jobName)
      

      Whereas in SchedulerEventMessageListenerWrapper#afterPropertiesSet() the RECEIVER_KEY is consumed like this:

      _key = _jobName.concat(StringPool.PERIOD).concat(_groupName);
      

      In many cases jobName == groupName, thus the problem remains hidden.

      Steps to reproduce

      1) Create an example portlet which has the following code

      Message message = new Message();
      
      message.put(
        SchedulerEngine.MESSAGE_LISTENER_CLASS_NAME,
        MessageListener2.class.getName());
      
      message.put(SchedulerEngine.PORTLET_ID, _portletId);
      
      Trigger trigger = new CronTrigger(
        _JOB_NAME, _GROUP_NAME, _CRON_PATTERN);
      
      try {
        SchedulerEngineUtil.schedule(
          trigger, StorageType.PERSISTED, "Test Schedule",
          DestinationNames.SCHEDULER_DISPATCH, message, 0);
      
        _log.info(_JOB_NAME + " scheduled for " + _portletId);
      }
      catch (SchedulerException se) {
        _log.error(se);
      }
      

      The main point to reproduce the issue to have jobName != groupName.

      You can use my sample code here: https://gist.github.com/laszlocsontos/4e65071477025e610e46

      2) Build the latest trunk

      3) Deploy the portlet you've just created

      Observe that there the message listener (MessageListener2) you've defined doesn't get triggered.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 13 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M3