KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jms > client > SessionDelegate


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.jms.client;
8
9 import java.io.Serializable JavaDoc;
10
11 import javax.jms.BytesMessage JavaDoc;
12 import javax.jms.Destination JavaDoc;
13 import javax.jms.JMSException JavaDoc;
14 import javax.jms.MapMessage JavaDoc;
15 import javax.jms.Message JavaDoc;
16 import javax.jms.MessageListener JavaDoc;
17 import javax.jms.ObjectMessage JavaDoc;
18 import javax.jms.Queue JavaDoc;
19 import javax.jms.StreamMessage JavaDoc;
20 import javax.jms.TextMessage JavaDoc;
21 import javax.transaction.xa.XAResource JavaDoc;
22
23 /**
24  * The implementation of a session
25  *
26  * @author <a HREF="mailto:adrian@jboss.org>Adrian Brock</a>
27  * @version $Revision: 1.4 $
28  */

29 public interface SessionDelegate
30    extends Lifecycle
31 {
32    // Constants -----------------------------------------------------
33

34    // Public --------------------------------------------------------
35

36    /**
37     *
38     * Acknowledge a message
39     *
40     * @param message the message to acknowledge
41     * @param acknowledge true for acknowledge, false for a Nack
42     */

43    void acknowledge(Message JavaDoc message, boolean acknowledge);
44
45    /**
46     * Commit a session
47     *
48     * @throws JMSException for any error
49     */

50    void commit() throws JMSException JavaDoc;
51
52    /**
53     * Create a queue browser
54     *
55     * @param queue the queue
56     * @param selector the message selector
57     * @return the browser
58     * @throws JMSException for any error
59     */

60    BrowserDelegate createBrowser(Queue JavaDoc queue, String JavaDoc selector) throws JMSException JavaDoc;
61
62    /**
63     * Create a bytes message
64     *
65     * @return the message
66     * @throws JMSException for any error
67     */

68    BytesMessage JavaDoc createBytesMessage() throws JMSException JavaDoc;
69
70    /**
71     * Create a consumer
72     *
73     * @param destination the destination
74     * @param subscription the subscription name
75     * @param selector the message selector
76     * @param noLocal the no local flag
77     * @return the consumer
78     * @throws JMSException for any error
79     */

80    ConsumerDelegate createConsumer(Destination JavaDoc destination, String JavaDoc subscription, String JavaDoc selector, boolean noLocal) throws JMSException JavaDoc;
81
82    /**
83     * Create a map message
84     *
85     * @return the message
86     * @throws JMSException for any error
87     */

88    MapMessage JavaDoc createMapMessage() throws JMSException JavaDoc;
89
90    /**
91     * Create a message
92     *
93     * @return the message
94     * @throws JMSException for any error
95     */

96    Message JavaDoc createMessage() throws JMSException JavaDoc;
97
98    /**
99     * Create an object message
100     *
101     * @param object the object
102     * @return the message
103     * @throws JMSException for any error
104     */

105    ObjectMessage JavaDoc createObjectMessage(Serializable JavaDoc object) throws JMSException JavaDoc;
106
107    /**
108     * Create a producer
109     *
110     * @param destination the destination
111     * @return the producer
112     * @throws JMSException for any error
113     */

114    ProducerDelegate createProducer(Destination JavaDoc destination) throws JMSException JavaDoc;
115
116    /**
117     * Create a stream message
118     *
119     * @return the message
120     * @throws JMSException for any error
121     */

122    StreamMessage JavaDoc createStreamMessage() throws JMSException JavaDoc;
123
124    /**
125     * Create a temporary destination
126     *
127     * @param type the type of temporary destination
128     * @return the temporary destination
129     * @throws JMSException for any error
130     */

131    Destination JavaDoc createTempDestination(int type) throws JMSException JavaDoc;
132
133    /**
134     * Create a text message
135     *
136     * @param text the text
137     * @return the message
138     * @throws JMSException for any error
139     */

140    TextMessage JavaDoc createTextMessage(String JavaDoc text) throws JMSException JavaDoc;
141
142    /**
143     * Retrieve a destination
144     *
145     * @param name the implementation dependent name
146     * @return the destination
147     * @throws JMSException for any error
148     */

149    Destination JavaDoc getDestination(String JavaDoc name) throws JMSException JavaDoc;
150
151    /**
152     * Retrieve the XAResource for this session
153     *
154     * @return the XAResource
155     */

156    XAResource JavaDoc getXAResource();
157
158    /**
159     * Recover a session
160     *
161     * @throws JMSException for any error
162     */

163    void recover() throws JMSException JavaDoc;
164
165    /**
166     * Rollback a session
167     *
168     * @throws JMSException for any error
169     */

170    void rollback() throws JMSException JavaDoc;
171
172    /**
173     * Run the session listener
174     *
175     * @throws JMSException for any error
176     */

177    void run();
178
179    /**
180     * Set the session's message listener
181     *
182     * @param listener the message listener
183     * @throws JMSException for any error
184     */

185    void setMessageListener(MessageListener JavaDoc listener) throws JMSException JavaDoc;
186
187    /**
188     * Unsubscribe the name
189     *
190     * @param name the name of the subscription
191     * @throws JMSException for any error
192     */

193    void unsubscribe(String JavaDoc name) throws JMSException JavaDoc;
194
195    // Inner Classes --------------------------------------------------
196
}
197
Popular Tags