View Javadoc

1   /*
2    * Created on Apr 22, 2004
3    *
4    * To change the template for this generated file go to
5    * Window - Preferences - Java - Code Generation - Code and Comments
6    */
7   package org.codehaus.activemq.service;
8   
9   import org.codehaus.activemq.broker.BrokerClient;
10  import org.codehaus.activemq.message.ActiveMQMessage;
11  import org.codehaus.activemq.message.ConsumerInfo;
12  import org.codehaus.activemq.message.MessageAck;
13  
14  import javax.jms.JMSException;
15  import java.util.Map;
16  
17  /***
18   * A manager of MessageContainer instances
19   */
20  public interface MessageContainerManager extends Service {
21  
22      /***
23       * Returns an unmodifiable map, indexed by String name, of all the {@link javax.jms.Destination}
24       * objects available in this container
25       *
26       * @return
27       */
28      public Map getDestinations();
29  
30      /***
31       * @param client
32       * @param info
33       * @throws JMSException
34       */
35      public abstract void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
36  
37      /***
38       * @param client
39       * @param info
40       * @throws JMSException
41       */
42      public abstract void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
43  
44      /***
45       * Delete a durable subscriber
46       *
47       * @param clientId
48       * @param subscriberName
49       * @throws JMSException if the subscriber doesn't exist or is still active
50       */
51      public abstract void deleteSubscription(String clientId, String subscriberName) throws JMSException;
52  
53      /***
54       * @param client
55       * @param message
56       * @throws JMSException
57       */
58      public abstract void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException;
59  
60      /***
61       * Acknowledge a message as being read and consumed by the Consumer
62       *
63       * @param client
64       * @param ack
65       * @throws JMSException
66       */
67      public abstract void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException;
68  
69  
70      /***
71       * Called after a rollback of a JMS transaction to redeliver the message to the consumers
72       * dispatch queue
73       *
74       * @param client
75       * @param ack
76       */
77      public void redeliverMessage(BrokerClient client, MessageAck ack) throws JMSException;
78  
79      /***
80       * Poll for messages
81       *
82       * @throws JMSException
83       */
84      public abstract void poll() throws JMSException;
85  
86  
87      /***
88       * A hook when the transaction is about to be commited; so apply all outstanding commands to the
89       * Journal if using a Journal (transaction log)
90       *
91       * @param client
92       * @param transactionId
93       */
94      public void commitTransaction(BrokerClient client, String transactionId) throws JMSException;
95  
96      /***
97       * A hook when the transaction is about to be rolled back; so discard all outstanding commands
98       * that are pending to be written to the Journal
99       *
100      * @param client
101      * @param transactionId
102      */
103     public void rollbackTransaction(BrokerClient client, String transactionId);
104 
105     /***
106      * Allows the lookup of a specific named message container
107      *
108      * @param physicalName
109      * @return
110      */
111     public MessageContainer getContainer(String physicalName) throws JMSException;
112 
113     /***
114      * This is a hook to notify the dispatcher for the clients subscription that
115      * we have acknowledged a message within a transaction but before the commit - so
116      * the message is not really being acknowledged here but this method is intended to be a hook
117      * to let the dispatcher know that we can now send another message to the client.
118      * <p/>
119      * Without this hook, if we have a prefetch value of 1, we can never consume 2 messages
120      * in a transaction, since the ack for the first message never arrives until the commit()
121      */
122     public void acknowledgeTransactedMessage(BrokerClient client, String transactionId, MessageAck ack) throws JMSException;
123 }