activemq-cpp-3.8.2
ActiveMQQueueBrowser.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_CORE_ACTIVEMQQUEUEBROWSER_H_
19 #define _ACTIVEMQ_CORE_ACTIVEMQQUEUEBROWSER_H_
20 
21 #include <activemq/util/Config.h>
22 
23 #include <cms/Queue.h>
24 #include <cms/QueueBrowser.h>
25 #include <cms/MessageEnumeration.h>
29 #include <decaf/lang/Pointer.h>
32 
33 #include <string>
34 
35 namespace activemq {
36 namespace core {
37 namespace kernels {
39 }
40 
41  class ActiveMQSession;
42  class Browser;
43 
45 
48  private:
49 
50  friend class Browser;
51 
55  std::string selector;
56  bool dispatchAsync;
57  cms::Queue* queue;
58  volatile bool closed;
59 
60  mutable decaf::util::concurrent::Mutex mutex;
61  mutable decaf::util::concurrent::Mutex wait;
63 
65 
66  private:
67 
69  ActiveMQQueueBrowser& operator=(const ActiveMQQueueBrowser&);
70 
71  public:
72 
74  const Pointer<commands::ConsumerId>& consumerId,
75  const Pointer<commands::ActiveMQDestination>& destination,
76  const std::string& selector,
77  bool dispatchAsync);
78 
79  virtual ~ActiveMQQueueBrowser();
80 
81  public:
82 
83  virtual const cms::Queue* getQueue() const;
84 
85  virtual std::string getMessageSelector() const;
86 
87  virtual cms::MessageEnumeration* getEnumeration();
88 
89  virtual void close();
90 
91  virtual bool hasMoreMessages();
92 
93  virtual cms::Message* nextMessage();
94 
95  private:
96 
97  void checkClosed();
98  void notifyMessageAvailable();
99  void waitForMessageAvailable();
100 
102  void destroyConsumer();
103 
104  };
105 
106 }}
107 
108 #endif /* _ACTIVEMQ_CORE_ACTIVEMQQUEUEBROWSER_H_ */
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition: Mutex.h:39
Root of all messages.
Definition: Message.h:88
#define AMQCPP_API
Definition: Config.h:30
This class implements in interface for browsing the messages in a Queue without removing them...
Definition: QueueBrowser.h:53
Definition: ActiveMQConsumerKernel.h:49
Defines an object that enumerates a collection of Messages.
Definition: MessageEnumeration.h:35
A boolean value that may be updated atomically.
Definition: AtomicBoolean.h:34
Definition: ActiveMQQueueBrowser.h:46
Definition: ActiveMQSession.h:42
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: ActiveMQSessionKernel.h:65
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
An interface encapsulating a provider-specific queue name.
Definition: Queue.h:37