[jboss-dev-forums] [Design of JBoss jBPM] - Re: Failure handling

bill.burke@jboss.com do-not-reply at jboss.com
Fri Aug 3 16:09:13 EDT 2007


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();
  |         }
  |     }
  | }
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070774#4070774

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070774



More information about the jboss-dev-forums mailing list