-
15. Re: Failure handling
estaub Aug 3, 2007 11:22 AM (in response to bill.burke)Bill,
Many thanks.
The DLQ technique certainly seems promising for the asynch continuation case.
The info on TransactionManager in various appservers is most helpful.
The code snippet really helped clarify the different scenarios you and Tom are thinking about, versus the one I was poorly describing.
-Ed -
16. Re: Failure handling
tom.baeyens Aug 3, 2007 11:29 AM (in response to bill.burke)the DLQ could be implemented in the JobExecutor MDB, no ?
but you need to know in the bean somehow that this is the last retry that JMS is going to give the message delivery.
if you then do atry { // continue asynchronously } catch (Exception e) { if (thisIsTheLastAttempt()) { signalInNewTransaction(execution.getId(), "failure); } }
execution would need to be reloaded in the new transaction method, but i think this could work.
would it make sense to update the MDB in that sense ?
can you know in JMS if this is the last retry that JMS is going to give the MDB to deliver the message ? -
17. Re: Failure handling
bill.burke Aug 3, 2007 4:09 PM (in response to bill.burke)i don't think we need to do it that way tom. Wouldn't this just work with no JBPM changes?
@MessageDriven(activationConfig= { ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"), ActivationConfigProperty(propertyName="messageSelector", propertyValue="jobId IS NOT NULL"), ActivationConfigProperty(propertyName="destination", propertyValue="queue/DLQ")}) public class DLQFailureHandler implements MessageListener { JbpmConfiguration jbpmConfiguration = null; @Resource(name="JbpmCfgResource") String jbpmCfgResource = null; @PostConstruct public void initJbpm() { jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfgResource); } public void onMessage(Message message) { long jobId = 0; try { jobId = message.getLongProperty("jobId"); } catch (JMSException ignored) { // message selector confirms existence } JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { JobSession jobSession = jbpmContext.getJobSession(); Job job = jobSession.loadJob(jobId); if (!(job instanceof ExecuteNodeJob)) { // do some other failure handling jbpmContext.close(); return; } ExecuteNodeJob executeNodeJob = (ExecuteNodeJob)job; if (executeNodeJob.getNode().hasLeavingTransition("failure")) { executeNodeJob.getProcessInstance().signal("failure"); jobSession.deleteJob(job); } else { // push to a different DLQ? } } finally { jbpmContext.close(); } } }
-
18. Re: Failure handling
bill.burke Aug 3, 2007 4:11 PM (in response to bill.burke)Srry...let me continue....Just write an MDB that activates on the DLQ. There isn't any modification to jbpm code. I don't think it could work the way you describe anyways.
-
19. Re: Failure handling
tom.baeyens Aug 4, 2007 3:34 AM (in response to bill.burke)the DLQ think should work also. but it's less portable. since we can't control the retries.
in the approach that i described, we could think about adding the retry count to the job. (decrementing the counter on failed attempt would have to be done in a separate tx, and that's a bit clumsy)
but then we can document the configurations. while with leveraging the JMS configuations, the configurations are JMS implementation specific.
With the DLQ approach, the retry count has to be configured for the whole Queue, right ? If we use the jbpm-retry mechanism, then we can have the retry count defined in the process.
Can you give a pointer as to why my proposed approach doesn't work ? Can it be made to work ? -
20. Re: Failure handling
bill.burke Aug 6, 2007 7:55 AM (in response to bill.burke)For JBoss at least, the retry count is configured at the MDB level. You pass it in as container configuration or as an activation property.
Felt like writing about this here:
http://bill.burkecentral.com/2007/08/06/guaranteed-jbpm-failure-handling/
I discussed why the Synchronization approach wouldn't work. -
21. Re: Failure handling
bradsdavis Mar 24, 2009 9:17 AM (in response to bill.burke)Bill, was the MDB approach settled to be the proper solution in 3.2.3GA+ environments?
Thanks for the great article too. Do you know if there is good documentation available for the different job types? -
22. Re: Failure handling
kukeltje Mar 24, 2009 6:52 PM (in response to bill.burke)Brad,
The chances are little Burk will read this. This forum does not automatically send you responses, not even if you started the topic. -
23. Re: Failure handling
bradsdavis Mar 24, 2009 7:21 PM (in response to bill.burke)You don't happen to know do you Ronald?
-
24. Re: Failure handling
kukeltje Mar 25, 2009 8:20 AM (in response to bill.burke)No sorry (and he did not read your comment yet as it is not visible on his blog) :-(