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
Multiple schedule jobs using the same Listener DXP 7.0
Hello everyone! I have a requirement on which users should be able to schedule jobs, as of now I have already managed to create a schedule job dynamically, but as soon as other one is created the previous stop working. I'm using the same listener since the job is exactly the same just some parameters change from execution to execution but in general its the same action. Here's a snippet of my code:
@Reference
EnvioNotificacionMessageListener envioNotificacion;
...
String listenerClass = EnvioNotificacionMessageListener.class.getName();
Trigger jobTrigger = _triggerFactory.createTrigger(
"Schedule Job Notificacion " + notificacion.getIdNotificacion(),
listenerClass, new Date(), fechaFin, "0 * * ? * * *");
SchedulerEntryImpl schedulerEntryImpl = new SchedulerEntryImpl();
schedulerEntryImpl.setEventListenerClass(listenerClass);
schedulerEntryImpl.setTrigger(jobTrigger);
Message message = new Message();
message.put("idNotificacion", notificacion.getIdNotificacion());
SchedulerEngineHelperUtil.schedule(jobTrigger, StorageType. PERSISTED,
"Trabajo", DestinationNames. SCHEDULER_DISPATCH, message, 10);
SchedulerEngineHelperUtil.register(envioNotificacion,
schedulerEntryImpl, DestinationNames. SCHEDULER_DISPATCH);
Hope you could help me to figure out what I need to change to finish this, thanks in advance!