KickJava   Java API By Example, From Geeks To Geeks.

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


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
48 import java.io.Serializable JavaDoc;
49
50 import javax.jms.Topic JavaDoc;
51
52 import org.mr.kernel.services.ServiceProducer;
53 /**
54  * A client uses a <CODE>TopicPublisher</CODE> object to publish messages on
55  * a topic. A <CODE>TopicPublisher</CODE> object is the publish-subscribe
56  * form of a message producer.
57  *
58  * <P>
59  * Normally, the <CODE>Topic</CODE> is specified when a <CODE>TopicPublisher
60  * </CODE> is created. In this case, an attempt to use the <CODE>publish
61  * </CODE> methods for an unidentified <CODE>TopicPublisher</CODE> will throw
62  * a <CODE>java.lang.UnsupportedOperationException</CODE>.
63  *
64  * <P>
65  * If the <CODE>TopicPublisher</CODE> is created with an unidentified <CODE>
66  * Topic</CODE>, an attempt to use the <CODE>publish</CODE> methods that
67  * assume that the <CODE>Topic</CODE> has been identified will throw a <CODE>
68  * java.lang.UnsupportedOperationException</CODE>.
69  *
70  * <P>
71  * During the execution of its <CODE>publish</CODE> method, a message must
72  * not be changed by other threads within the client. If the message is
73  * modified, the result of the <CODE>publish</CODE> is undefined.
74  *
75  * <P>
76  * After publishing a message, a client may retain and modify it without
77  * affecting the message that has been published. The same message object may
78  * be published multiple times.
79  *
80  * <P>
81  * The following message headers are set as part of publishing a message:
82  * <code>JMSDestination</code>,<code>JMSDeliveryMode</code>,<code>JMSExpiration</code>,
83  * <code>JMSPriority</code>,<code>JMSMessageID</code> and <code>JMSTimeStamp</code>.
84  * When the message is published, the values of these headers are ignored.
85  * After completion of the <CODE>publish</CODE>, the headers hold the values
86  * specified by the method publishing the message. It is possible for the
87  * <CODE>publish</CODE> method not to set <code>JMSMessageID</code> and
88  * <code>JMSTimeStamp</code> if the setting of these headers is explicitly
89  * disabled by the <code>MessageProducer.setDisableMessageID</code> or <code>MessageProducer.setDisableMessageTimestamp</code>
90  * method.
91  *
92  * <P>
93  * Creating a <CODE>MessageProducer</CODE> provides the same features as
94  * creating a <CODE>TopicPublisher</CODE>. A <CODE>MessageProducer</CODE>
95  * object is recommended when creating new code. The <CODE>TopicPublisher
96  * </CODE> is provided to support existing code.
97  *
98  *
99  * <P>
100  * Because <CODE>TopicPublisher</CODE> inherits from <CODE>MessageProducer
101  * </CODE>, it inherits the <CODE>send</CODE> methods that are a part of the
102  * <CODE>MessageProducer</CODE> interface. Using the <CODE>send</CODE>
103  * methods will have the same effect as using the <CODE>publish</CODE>
104  * methods: they are functionally the same.
105  *
106  * @author Nimo
107  *
108  *
109  */

110 public class MantaTopicPublisher extends MantaMessageProducer implements Serializable JavaDoc, javax.jms.TopicPublisher JavaDoc {
111     
112     /**
113      * Construct a TopicPublisher object.
114      *
115      * @param clientID - id for this publisher
116      * @param sess - the creating session
117      * @param topic - the topic to publish on
118      * @param service - the MantaService we are talking about.
119      */

120     public MantaTopicPublisher(String JavaDoc clientID, MantaSession sess, Topic JavaDoc topic,ServiceProducer service){
121         super(clientID, sess, topic, service);
122     }//MantaTopicPublisher
123

124
125     /**
126      * Notice, that this class suffers from the 1.0.2. -> 1.1 transition.
127      * Therefore, it has the send (Destination...) methods, because it
128      * inherits MessageProducer.
129      * This means that using the TopicPublisher, it is possible to send
130      * messages to a queue.
131      * however, this is considered a misuse.
132      */

133     
134 }//MantaTopicPublisher
135
Popular Tags