1 2 Previous Next 24 Replies Latest reply on Mar 25, 2009 8:20 AM by kukeltje Go to original post
      • 15. Re: Failure handling

        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

          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 a

          try {
           // 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

            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

              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

                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

                  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

                    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

                      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

                        You don't happen to know do you Ronald?

                        • 24. Re: Failure handling
                          kukeltje

                          No sorry (and he did not read your comment yet as it is not visible on his blog) :-(

                          1 2 Previous Next