Multiple schedule jobs using the same Listener DXP 7.0Multiple schedule jobs using the same Listener DXP 7.0https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1210877852024-03-29T13:08:21Z2024-03-29T13:08:21ZMultiple schedule jobs using the same Listener DXP 7.0Uriel Flores Valdovinoshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1210877842021-09-17T17:26:45Z2021-08-30T22:46:38Z<p>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:</p>
<p>@Reference<br /> EnvioNotificacionMessageListener envioNotificacion;</p>
<p>...</p>
<p>String listenerClass = EnvioNotificacionMessageListener.<b>class</b>.getName();</p>
<p> </p>
<p> Trigger jobTrigger = _triggerFactory.createTrigger(</p>
<p> "Schedule Job Notificacion " + notificacion.getIdNotificacion(),</p>
<p> listenerClass, <b>new</b> Date(), fechaFin, "0 * * ? * * *");</p>
<p> </p>
<p> SchedulerEntryImpl schedulerEntryImpl = <b>new</b> SchedulerEntryImpl();</p>
<p> schedulerEntryImpl.setEventListenerClass(listenerClass);</p>
<p> schedulerEntryImpl.setTrigger(jobTrigger);</p>
<p> </p>
<p> Message message = <b>new</b> Message();</p>
<p> message.put("idNotificacion", notificacion.getIdNotificacion());</p>
<p> </p>
<p> SchedulerEngineHelperUtil.<i>schedule</i>(jobTrigger, StorageType.<b>
<i>PERSISTED</i></b>,</p>
<p> "Trabajo", DestinationNames.<b>
<i>SCHEDULER_DISPATCH</i></b>, message, 10);</p>
<p> </p>
<p> SchedulerEngineHelperUtil.<i>register</i>(envioNotificacion,</p>
<p> schedulerEntryImpl, DestinationNames.<b>
<i>SCHEDULER_DISPATCH</i></b>);</p>
<p> </p>
<p>Hope you could help me to figure out what I need to change to finish
this, thanks in advance!</p>