1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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  }