activemq-cpp-3.9.5
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
27#include <decaf/lang/Pointer.h>
28
29namespace activemq {
30namespace core {
31namespace kernels {
33}
34
35 using decaf::lang::Pointer;
36 using activemq::commands::MessageDispatch;
37
38 class ActiveMQConsumer;
39
44 class AMQCPP_API ActiveMQSessionExecutor : activemq::threads::Task {
45 private:
46
49
52
55
56 private:
57
58 ActiveMQSessionExecutor(const ActiveMQSessionExecutor&);
59 ActiveMQSessionExecutor& operator=(const ActiveMQSessionExecutor&);
60
61 public:
62
67
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_*/
#define AMQCPP_API
Definition Config.h:30
Definition ActiveMQConsumer.h:40
virtual void stop()
Stops dispatching.
std::vector< Pointer< MessageDispatch > > getUnconsumedMessages()
Definition ActiveMQSessionExecutor.h:157
virtual bool isEmpty()
Definition ActiveMQSessionExecutor.h:134
ActiveMQSessionExecutor(activemq::core::kernels::ActiveMQSessionKernel *session)
Creates an un-started executor for the given session.
virtual bool hasUncomsumedMessages() const
Definition ActiveMQSessionExecutor.h:97
virtual void close()
Terminates the dispatching thread.
Definition ActiveMQSessionExecutor.h:120
virtual void start()
Starts the dispatching.
virtual bool isRunning() const
Definition ActiveMQSessionExecutor.h:127
virtual bool iterate()
Iterates on the MessageDispatchChannel sending all pending messages to the Consumers they are destine...
virtual void clearMessagesInProgress()
Removes all messages in the Dispatch Channel so that non are delivered.
Definition ActiveMQSessionExecutor.h:90
virtual void wakeup()
wakeup this executer and dispatch any pending messages.
virtual void executeFirst(const Pointer< MessageDispatch > &data)
Executes the dispatch.
virtual void clear()
Removes all queued messages and destroys them.
Definition ActiveMQSessionExecutor.h:141
virtual ~ActiveMQSessionExecutor()
Calls stop() then clear().
virtual void execute(const Pointer< MessageDispatch > &data)
Executes the dispatch.
Definition ActiveMQSessionKernel.h:67
Represents a unit of work that requires one or more iterations to complete.
Definition Task.h:31
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
Definition ActiveMQQueueBrowser.h:37
Definition ActiveMQTempDestination.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24