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  
19  /**
20   * <a href="DefaultSingleDestinationMessageSender.java.html"><b><i>View Source
21   * </i></b></a>
22   *
23   * @author Michael C. Han
24   */
25  public class DefaultSingleDestinationMessageSender
26      implements SingleDestinationMessageSender {
27  
28      public DefaultSingleDestinationMessageSender() {
29      }
30  
31      /**
32       * @deprecated
33       */
34      public DefaultSingleDestinationMessageSender(
35          String destinationName, MessageSender messageSender) {
36  
37          _destinationName = destinationName;
38          _messageSender = messageSender;
39      }
40  
41      public void send(Message message) {
42          _messageSender.send(_destinationName, message);
43      }
44  
45      public void send(Object payload) {
46          Message message = new Message();
47  
48          message.setPayload(payload);
49  
50          send(message);
51      }
52  
53      public void setDestinationName(String destinationName) {
54          _destinationName = destinationName;
55      }
56  
57      public void setMessageSender(MessageSender messageSender) {
58          _messageSender = messageSender;
59      }
60  
61      private String _destinationName;
62      private MessageSender _messageSender;
63  
64  }