1 package org.jbpm.bpel.service.exe; 2 3 import java.util.Collections ; 4 import java.util.Map ; 5 6 import javax.jms.Destination ; 7 import javax.jms.JMSException ; 8 import javax.jms.ObjectMessage ; 9 10 import org.w3c.dom.Element ; 11 12 import org.jbpm.graph.exe.ProcessInstance; 13 import org.jbpm.graph.exe.Token; 14 15 import org.jbpm.bpel.def.BpelDefinition; 16 import org.jbpm.bpel.service.def.Receiver; 17 18 22 public class StartListener extends RequestListener { 23 24 public StartListener(Receiver receiver) { 25 super(receiver); 26 } 27 28 29 public void deliverRequest(ObjectMessage request) throws JMSException { 30 Receiver receiver = getReceiver(); 32 BpelDefinition process = receiver.getInboundMessageActivity().getBpelDefinition(); 33 ProcessInstance instance = process.createProcessInstance(); 34 Token token = instance.getRootToken(); 36 Destination replyTo = request.getJMSReplyTo(); 38 if (replyTo != null) { 39 receiver.registerRequest(new OutstandingRequest(replyTo, request.getJMSMessageID()), token); 40 } 41 Element messageElem = (Element ) request.getObject(); 43 44 receiver.readMessage(messageElem, token); 45 process.triggerProcessInstance(instance, receiver); 47 } 48 49 protected Map getReceptionProperties() { 50 return Collections.EMPTY_MAP; 51 } 52 } | Popular Tags |