View Javadoc

1   /*
2    * $Id: MuleMessageService.java 11566 2008-04-11 12:15:16Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.bpm.jbpm;
12  
13  import org.mule.api.MuleMessage;
14  
15  import java.util.Map;
16  
17  import org.apache.commons.lang.NotImplementedException;
18  import org.jbpm.graph.exe.Token;
19  import org.jbpm.job.Job;
20  
21  /**
22   * jBPM has built-in support for messaging via the org.jbpm.msg.MessageService interface, 
23   * the idea being that one can plug in a JMS implementation and send messages from a process 
24   * using a standard "<message>" construct.  
25   * 
26   * If Mule were to implement this interface, one could make Mule the standard MessageService 
27   * instead of JMS, which would make the Mule/jBPM integration more "seamless".
28   * 
29   * This is an unfinished work, see MULE-1219
30   */
31  public class MuleMessageService implements org.jbpm.msg.MessageService
32  {
33  
34      private static final long serialVersionUID = 1L;
35  
36      protected static org.mule.transport.bpm.MessageService proxy;
37  
38      public MuleMessageService()
39      {
40          super();
41      }
42  
43      public static void setMessageService(org.mule.transport.bpm.MessageService msgService)
44      {
45          proxy = msgService;
46      }
47  
48      // TODO This should be replaced by the standard send() method below, which would
49      // make Mule the default messaging service within jBpm.
50      public MuleMessage generateMessage(String endpoint,
51                                        Object payloadObject,
52                                        Map messageProperties,
53                                        boolean synchronous) throws Exception
54      {
55          return proxy.generateMessage(endpoint, payloadObject, messageProperties, synchronous);
56      }
57  
58      public void send(Job job) 
59      {
60          throw new NotImplementedException("MULE-1219");
61      }
62  
63      public void suspendMessages(Token token)
64      {
65          // no-op
66      }
67  
68      public void resumeMessages(Token token)
69      {
70          // no-op
71      }
72  
73      public void close()
74      {
75          // nop-op
76      }
77  
78  }