01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
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 topicName,
38: String subscriptionName, MessageListener listener)
39: throws Exception;
40:
41: void registerListener(String destinationName,
42: MessageListener listener) throws Exception;
43:
44: void unregisterListener(MessageListener listener);
45:
46: Sender getSender(String destinationName, boolean transacted);
47:
48: Sender getSender(String destinationName);
49:
50: void unregisterSender(Sender sender);
51:
52: /**
53: * Suspends all sending and delivering of JMS messages. This method should only return when
54: * no more send or receives are in progress.
55: *
56: * @param msecs maximum time to wait for active sends/receives to end
57: */
58: boolean suspend(long msecs) throws InterruptedException;
59:
60: /**
61: * Continues sending and delivering of JMS messages after it has previously been resumed.
62: */
63: void resume();
64: }
|