View Javadoc

1   /*
2    * $Id: MuleMessageService.java 7963 2007-08-21 08:53:15Z dirk.olmes $
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.providers.bpm.jbpm;
12  
13  import org.mule.umo.UMOMessage;
14  
15  import java.util.Map;
16  
17  import org.jbpm.graph.exe.Token;
18  import org.jbpm.msg.Message;
19  
20  /**
21   * jBPM has built-in support for messaging via the org.jbpm.msg.MessageService interface, 
22   * the idea being that one can plug in a JMS implementation and send messages from a process 
23   * using a standard "<message>" construct.  
24   * 
25   * If Mule were to implement this interface, one could make Mule the standard MessageService 
26   * instead of JMS, which would make the Mule/jBPM integration more "seamless".
27   * 
28   * This is an unfinished work, see MULE-1219
29   */
30  public class MuleMessageService implements org.jbpm.msg.MessageService
31  {
32  
33      private static final long serialVersionUID = 1L;
34  
35      protected static org.mule.providers.bpm.MessageService proxy;
36  
37      public MuleMessageService()
38      {
39          super();
40      }
41  
42      public static void setMessageService(org.mule.providers.bpm.MessageService msgService)
43      {
44          proxy = msgService;
45      }
46  
47      // TODO This should be replaced by the standard send() method below, which would
48      // make Mule the default messaging service within jBpm.
49      public UMOMessage generateMessage(String endpoint,
50                                        Object payloadObject,
51                                        Map messageProperties,
52                                        boolean synchronous) throws Exception
53      {
54          return proxy.generateMessage(endpoint, payloadObject, messageProperties, synchronous);
55      }
56  
57      public void send(Message message)
58      {
59          // no-op
60      }
61  
62      public void suspendMessages(Token token)
63      {
64          // no-op
65      }
66  
67      public void resumeMessages(Token token)
68      {
69          // no-op
70      }
71  
72      public void close()
73      {
74          // nop-op
75      }
76  
77  }