1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.messaging.sender;
16  
17  import com.liferay.portal.kernel.messaging.Message;
18  import com.liferay.portal.kernel.messaging.MessageBusException;
19  
20  /**
21   * <a href="DefaultSingleDestinationSynchronousMessageSender.java.html"><b>
22   * <i>View Source</i></b></a>
23   *
24   * @author Michael C. Han
25   */
26  public class DefaultSingleDestinationSynchronousMessageSender
27      implements SingleDestinationSynchronousMessageSender {
28  
29      public DefaultSingleDestinationSynchronousMessageSender() {
30      }
31  
32      /**
33       * @deprecated
34       */
35      public DefaultSingleDestinationSynchronousMessageSender(
36          String destinationName,
37          SynchronousMessageSender synchronousMessageSender) {
38  
39          _destinationName = destinationName;
40          _synchronousMessageSender = synchronousMessageSender;
41      }
42  
43      public Object send(Message message) throws MessageBusException {
44          return _synchronousMessageSender.send(_destinationName, message);
45      }
46  
47      public Object send(Message message, long timeout)
48          throws MessageBusException {
49  
50          return _synchronousMessageSender.send(
51              _destinationName, message, timeout);
52      }
53  
54      public Object send(Object payload) throws MessageBusException {
55          Message message = new Message();
56  
57          message.setPayload(payload);
58  
59          return send(message);
60      }
61  
62      public Object send(Object payload, long timeout)
63          throws MessageBusException {
64  
65          Message message = new Message();
66  
67          message.setPayload(payload);
68  
69          return send(message, timeout);
70      }
71  
72      public void setDestinationName(String destinationName) {
73          _destinationName = destinationName;
74      }
75  
76      public void setSynchronousMessageSender(
77          SynchronousMessageSender synchronousMessageSender) {
78  
79          _synchronousMessageSender = synchronousMessageSender;
80      }
81  
82      private String _destinationName;
83      private SynchronousMessageSender _synchronousMessageSender;
84  
85  }