Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jbpm.ejb;
 
 import  javax.jms.JMSException;
 import  javax.jms.Message;
 
Message-driven bean that listens for messages containing a reference to a pending job for asynchronous continuations.

The message must have a long property called jobId which identifies a job in the database. The message body, if any, is ignored.

Environment

This bean inherits its environment entries and resources available for customization from CommandListenerBean.

Author(s):
Alejandro Guizar
public class JobListenerBean extends CommandListenerBean {
  private static final long serialVersionUID = 1L;
  private static final Log log = LogFactory.getLog(JobListenerBean.class);
  protected Command extractCommand(Message messagethrows JMSException {
    // check for jobId property
    if (message.propertyExists("jobId")) {
      long jobId = message.getLongProperty("jobId");
      return new ExecuteJobCommand(jobId);
    }
    else {
      // check for command object
      Command command = super.extractCommand(message);
      if (command != null) {
        return command;
      }
      else {
        .warn("neither property jobId nor command found");
      }
    }
    return null;
  }
New to GrepCode? Check out our FAQ X