activemq-cpp-3.8.2
ActiveMQSessionExecutor.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_ACTIVEMQSESSIONEXECUTOR_
19 #define ACTIVEMQ_CORE_ACTIVEMQSESSIONEXECUTOR_
20 
21 #include <activemq/util/Config.h>
25 #include <activemq/threads/Task.h>
27 #include <decaf/lang/Pointer.h>
28 
29 namespace activemq{
30 namespace core{
31 namespace kernels{
32  class ActiveMQSessionKernel;
33 }
34 
37 
38  class ActiveMQConsumer;
39 
45  private:
46 
49 
52 
55 
56  private:
57 
60 
61  public:
62 
67 
71  virtual ~ActiveMQSessionExecutor();
72 
78  virtual void execute(const Pointer<MessageDispatch>& data);
79 
85  virtual void executeFirst(const Pointer<MessageDispatch>& data);
86 
90  virtual void clearMessagesInProgress() {
91  this->messageQueue->clear();
92  }
93 
97  virtual bool hasUncomsumedMessages() const {
98  return !messageQueue->isClosed() && messageQueue->isRunning() && !messageQueue->isEmpty();
99  }
100 
104  virtual void wakeup();
105 
109  virtual void start();
110 
114  virtual void stop();
115 
120  virtual void close() {
121  this->messageQueue->close();
122  }
123 
127  virtual bool isRunning() const {
128  return this->messageQueue->isRunning();
129  }
130 
134  virtual bool isEmpty() {
135  return messageQueue->isEmpty();
136  }
137 
141  virtual void clear() {
142  this->messageQueue->clear();
143  }
144 
151  virtual bool iterate();
152 
157  std::vector< Pointer<MessageDispatch> > getUnconsumedMessages() {
158  return messageQueue->removeAll();
159  }
160 
161  private:
162 
167  virtual void dispatch(const Pointer<MessageDispatch>& data);
168 
169  };
170 
171 }}
172 
173 #endif /*ACTIVEMQ_CORE_ACTIVEMQSESSIONEXECUTOR_*/
virtual void close()
Terminates the dispatching thread.
Definition: ActiveMQSessionExecutor.h:120
Represents a unit of work that requires one or more iterations to complete.
Definition: Task.h:31
virtual bool isRunning() const
Definition: ActiveMQSessionExecutor.h:127
#define AMQCPP_API
Definition: Config.h:30
virtual bool isEmpty()
Definition: ActiveMQSessionExecutor.h:134
std::vector< Pointer< MessageDispatch > > getUnconsumedMessages()
Definition: ActiveMQSessionExecutor.h:157
virtual bool hasUncomsumedMessages() const
Definition: ActiveMQSessionExecutor.h:97
Definition: MessageDispatch.h:50
Delegate dispatcher for a single session.
Definition: ActiveMQSessionExecutor.h:44
virtual void clearMessagesInProgress()
Removes all messages in the Dispatch Channel so that non are delivered.
Definition: ActiveMQSessionExecutor.h:90
virtual void clear()
Removes all queued messages and destroys them.
Definition: ActiveMQSessionExecutor.h:141
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