KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > presumo > jms > client > JmsQueueSender


1 /**
2  * This file is part of Presumo.
3  *
4  * Presumo is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Presumo is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Presumo; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  *
19  * Copyright 2001 Dan Greff
20  */

21 package com.presumo.jms.client;
22
23 import javax.jms.IllegalStateException JavaDoc;
24 import javax.jms.JMSException JavaDoc;
25 import javax.jms.Message JavaDoc;
26 import javax.jms.Queue JavaDoc;
27 import javax.jms.QueueSender JavaDoc;
28
29 /**
30  * @see javax.jms.QueueSender
31  */

32 public final class JmsQueueSender extends JmsMessageProducer
33     implements QueueSender JavaDoc
34 {
35
36   private final JmsQueue queue;
37
38     /////////////////////////////////////////////////////////////////////////
39
// Constructors //
40
/////////////////////////////////////////////////////////////////////////
41

42   JmsQueueSender(JmsQueueSession session, JmsQueue queue)
43   {
44     super(session);
45     this.queue = queue;
46   }
47
48
49     /////////////////////////////////////////////////////////////////////////
50
// Public Methods //
51
/////////////////////////////////////////////////////////////////////////
52

53   public Queue JavaDoc getQueue() throws JMSException JavaDoc
54   {
55     return queue;
56   }
57
58
59   public final void send(Message JavaDoc message) throws JMSException JavaDoc
60   {
61     prepareAndSend(this.queue, message, this.deliveryMode,
62                    this.priority, this.timeToLive);
63   }
64
65
66   public final void send(Message JavaDoc message,
67                          int deliveryMode,
68                          int priority,
69                          long timeToLive)
70     throws JMSException JavaDoc
71   {
72     prepareAndSend(this.queue, message, deliveryMode, priority, timeToLive);
73   }
74
75     
76   public final void send(Queue JavaDoc queue, Message JavaDoc message) throws JMSException JavaDoc
77   {
78     prepareAndSend(queue, message, this.deliveryMode,
79                    this.priority, this.timeToLive);
80   }
81
82     
83   public final void send(Queue JavaDoc queue,
84                          Message JavaDoc message,
85                          int deliveryMode,
86                          int priority,
87                          long timeToLive)
88     throws JMSException JavaDoc
89   {
90     prepareAndSend(queue, message, deliveryMode, priority, timeToLive);
91   }
92
93
94 }
95
Popular Tags