1 package org.exolab.jms.messagemgr;
2
3 import javax.jms.JMSException;
4
5 import org.exolab.jms.message.MessageImpl;
6
7
8 /***
9 * MessageCache is responsible for managing a collection of messages. Messages
10 * in the cache are referenced via {@link MessageRef} instances
11 *
12 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
13 * @version $Revision: 1.3 $ $Date: 2005/08/30 07:26:49 $
14 */
15 public interface MessageCache {
16
17 /***
18 * Add a reference and its corresponding message to the cache
19 *
20 * @param reference the reference to the message
21 * @param message the message
22 */
23 void addMessage(MessageRef reference, MessageImpl message);
24
25 /***
26 * Adds a message reference to the cache
27 *
28 * @param reference the message reference to add
29 */
30 void addMessageRef(MessageRef reference);
31
32 /***
33 * Returns a message reference, given its identifier
34 *
35 * @param messageId the message identifier
36 * @return the message reference associated with <code>messageId</code>, or
37 * <code>null</code> if none exists
38 */
39 MessageRef getMessageRef(String messageId);
40
41 /***
42 * Returns the message corresponding to the specified reference
43 *
44 * @param reference the message reference
45 * @return the associated message, or <code>null</code> if none exists
46 * @throws JMSException for any error
47 */
48 MessageImpl getMessage(MessageRef reference)
49 throws JMSException;
50
51 /***
52 * Destroys the message corresponding to the reference
53 *
54 * @throws JMSException for any error
55 */
56 void destroy(MessageRef reference) throws JMSException;
57
58 }