activemq-cpp-3.6.0
ActiveMQConsumer.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 #ifndef _ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_
18 #define _ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_
19 
20 #include <cms/MessageConsumer.h>
21 #include <cms/MessageListener.h>
22 #include <cms/Message.h>
23 #include <cms/CMSException.h>
24 
25 #include <activemq/util/Config.h>
29 
30 #include <decaf/lang/Pointer.h>
31 
32 namespace activemq{
33 namespace core{
34 
36 
37  class ActiveMQSession;
38  class ActiveMQConsumerData;
39 
41  private:
42 
43  ActiveMQConsumerData* config;
44 
45  private:
46 
48  ActiveMQConsumer& operator= ( const ActiveMQConsumer& );
49 
50  public:
51 
60 
61  virtual ~ActiveMQConsumer();
62 
63  public: // Interface Implementation for cms::MessageConsumer
64 
65  virtual void start();
66 
67  virtual void stop();
68 
69  virtual void close();
70 
71  virtual cms::Message* receive();
72 
73  virtual cms::Message* receive(int millisecs);
74 
75  virtual cms::Message* receiveNoWait();
76 
77  virtual void setMessageListener(cms::MessageListener* listener);
78 
79  virtual cms::MessageListener* getMessageListener() const;
80 
81  virtual void setMessageAvailableListener(cms::MessageAvailableListener* listener);
82 
83  virtual cms::MessageAvailableListener* getMessageAvailableListener() const;
84 
85  virtual std::string getMessageSelector() const;
86 
87  virtual void setMessageTransformer(cms::MessageTransformer* transformer);
88 
89  virtual cms::MessageTransformer* getMessageTransformer() const;
90 
91  public:
92 
97  const Pointer<commands::ConsumerInfo>& getConsumerInfo() const;
98 
103  const Pointer<commands::ConsumerId>& getConsumerId() const;
104 
108  bool isClosed() const;
109 
113  int getMessageAvailableCount() const;
114 
124  void setRedeliveryPolicy(RedeliveryPolicy* policy);
125 
132  RedeliveryPolicy* getRedeliveryPolicy() const;
133 
140  decaf::lang::Exception* getFailureError() const;
141 
142  };
143 
144 }}
145 
146 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_*/