KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > api > jms > MantaQueueSender


1 /*
2  * Copyright 2002 by
3  * <a HREF="http://www.coridan.com">Coridan</a>
4  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
5  *
6  * The contents of this file are subject to the Mozilla Public License Version
7  * 1.1 (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is "MantaRay" (TM).
17  *
18  * The Initial Developer of the Original Code is Nimo.
19  * Portions created by the Initial Developer are Copyright (C) 2006
20  * Coridan Inc. All Rights Reserved.
21  *
22  * Contributor(s): all the names of the contributors are added in the source
23  * code where applicable.
24  *
25  * Alternatively, the contents of this file may be used under the terms of the
26  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
27  * provisions of LGPL are applicable instead of those above. If you wish to
28  * allow use of your version of this file only under the terms of the LGPL
29  * License and not to allow others to use your version of this file under
30  * the MPL, indicate your decision by deleting the provisions above and
31  * replace them with the notice and other provisions required by the LGPL.
32  * If you do not delete the provisions above, a recipient may use your version
33  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
34  
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Lesser General Public License as published by the Free Software Foundation;
39  * either version 2.1 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
44  * License for more details.
45  */

46 package org.mr.api.jms;
47 import java.io.Serializable JavaDoc;
48
49 import javax.jms.Queue JavaDoc;
50
51 import org.mr.kernel.services.ServiceProducer;
52
53 /** A client uses a <CODE>QueueSender</CODE> object to send messages to a queue.
54   *
55   * <P>Normally, the <CODE>Queue</CODE> is specified when a
56   * <CODE>QueueSender</CODE> is created. In this case, an attempt to use
57   * the <CODE>send</CODE> methods for an unidentified
58   * <CODE>QueueSender</CODE> will throw a
59   * <CODE>java.lang.UnsupportedOperationException</CODE>.
60   *
61   * <P>If the <CODE>QueueSender</CODE> is created with an unidentified
62   * <CODE>Queue</CODE>, an attempt to use the <CODE>send</CODE> methods that
63   * assume that the <CODE>Queue</CODE> has been identified will throw a
64   * <CODE>java.lang.UnsupportedOperationException</CODE>.
65   *
66   * <P>During the execution of its <CODE>send</CODE> method, a message
67   * must not be changed by other threads within the client.
68   * If the message is modified, the result of the <CODE>send</CODE> is
69   * undefined.
70   *
71   * <P>After sending a message, a client may retain and modify it
72   * without affecting the message that has been sent. The same message
73   * object may be sent multiple times.
74   *
75   * <P>The following message headers are set as part of sending a
76   * message: <code>JMSDestination</code>, <code>JMSDeliveryMode</code>,
77   * <code>JMSExpiration</code>, <code>JMSPriority</code>,
78   * <code>JMSMessageID</code> and <code>JMSTimeStamp</code>.
79   * When the message is sent, the values of these headers are ignored.
80   * After the completion of the <CODE>send</CODE>, the headers hold the values
81   * specified by the method sending the message. It is possible for the
82   * <code>send</code> method not to set <code>JMSMessageID</code> and
83   * <code>JMSTimeStamp</code> if the
84   * setting of these headers is explicitly disabled by the
85   * <code>MessageProducer.setDisableMessageID</code> or
86   * <code>MessageProducer.setDisableMessageTimestamp</code> method.
87   *
88   * <P>Creating a <CODE>MessageProducer</CODE> provides the same features as
89   * creating a <CODE>QueueSender</CODE>. A <CODE>MessageProducer</CODE> object is
90   * recommended when creating new code. The <CODE>QueueSender</CODE> is
91   * provided to support existing code.
92   *
93   * @author Nimo
94   *
95   */

96     
97     public class MantaQueueSender extends MantaMessageProducer implements Serializable JavaDoc, javax.jms.QueueSender JavaDoc {
98
99     /**
100      * This class is from JMS1.0.2. A QueueSender object is created when a client
101      * wants to send messages to a specific queues.
102      * In JMS1.1 it is preferred to use the <code>MessageProducer</code> class.
103      *
104      * All this constructor does is delegate the creation to the MantaMessageProducer
105      * class.
106      *
107      * @param clientId - the sender's id.
108      * @param sess - the creating session.
109      * @param queue - the target queue.
110      * @param service - the service on the MantaAgent.
111      */

112         
113     public MantaQueueSender(String JavaDoc clientId, MantaSession sess, Queue JavaDoc queue, ServiceProducer service){
114         super(clientId, sess, queue,service);
115     }//MantaQueueSender
116

117     /**
118      * Notice, that this class suffers from the 1.0.2. -> 1.1 transition.
119      * Therefore, it has the send (Destination...) methods, because it
120      * inherits MessageProducer.
121      * This means that using the QueueSender, it is possible to send
122      * messages to a topic.
123      * however, this is considered a misuse.
124      */

125     
126 }//MantaQueueSender
127
Popular Tags