KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > jms > JmsClient


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.jms;
17
18 import javax.jms.MessageListener JavaDoc;
19
20 /**
21  * A JMS Client.
22  *
23  * <p>The purpose of the JMS client is:
24  * <ul>
25  * <li>To have one location where the JMS connections are configured and established
26  * (instead of having each component do that of its own).
27  * <li>To automatically resume the JMS connection on failures, and hide these failures from
28  * the clients. Ideally, the users of this JmsClient should not be aware whether the
29  * connection with the JMS service is there or not. Message send calls should block
30  * until the connection is back, and message delivery should automatically restart.
31  * <li>To allow suspending the sending and delivery of JMS messages, useful while doing
32  * backups.
33  * </ul>
34  *
35  */

36 public interface JmsClient {
37     void registerDurableTopicListener(String JavaDoc topicName, String JavaDoc subscriptionName, MessageListener JavaDoc listener) throws Exception JavaDoc;
38
39     void registerListener(String JavaDoc destinationName, MessageListener JavaDoc listener) throws Exception JavaDoc;
40
41     void unregisterListener(MessageListener JavaDoc listener);
42
43     Sender getSender(String JavaDoc destinationName);
44
45     void unregisterSender(Sender sender);
46
47     /**
48      * Suspends all sending and delivering of JMS messages. This method should only return when
49      * no more send or receives are in progress.
50      *
51      * @param msecs maximum time to wait for active sends/receives to end
52      */

53     boolean suspend(long msecs) throws InterruptedException JavaDoc;
54
55     /**
56      * Continues sending and delivering of JMS messages after it has previously been resumed.
57      */

58     void resume();
59 }
60
Popular Tags