00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef _ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_ 00018 #define _ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_ 00019 00020 #include <cms/MessageConsumer.h> 00021 #include <cms/MessageListener.h> 00022 #include <cms/Message.h> 00023 #include <cms/CMSException.h> 00024 00025 #include <activemq/util/Config.h> 00026 #include <activemq/core/kernels/ActiveMQConsumerKernel.h> 00027 #include <activemq/commands/ConsumerInfo.h> 00028 #include <activemq/core/RedeliveryPolicy.h> 00029 00030 #include <decaf/lang/Pointer.h> 00031 00032 namespace activemq{ 00033 namespace core{ 00034 00035 using decaf::lang::Pointer; 00036 00037 class ActiveMQSession; 00038 class ActiveMQConsumerData; 00039 00040 class AMQCPP_API ActiveMQConsumer : public cms::MessageConsumer { 00041 private: 00042 00043 ActiveMQConsumerData* config; 00044 00045 private: 00046 00047 ActiveMQConsumer(const ActiveMQConsumer&); 00048 ActiveMQConsumer& operator=(const ActiveMQConsumer&); 00049 00050 public: 00051 00059 ActiveMQConsumer(const Pointer<activemq::core::kernels::ActiveMQConsumerKernel>& kernel); 00060 00061 virtual ~ActiveMQConsumer(); 00062 00063 public: // Interface Implementation for cms::MessageConsumer 00064 00065 virtual void start(); 00066 00067 virtual void stop(); 00068 00069 virtual void close(); 00070 00071 virtual cms::Message* receive(); 00072 00073 virtual cms::Message* receive(int millisecs); 00074 00075 virtual cms::Message* receiveNoWait(); 00076 00077 virtual void setMessageListener(cms::MessageListener* listener); 00078 00079 virtual cms::MessageListener* getMessageListener() const; 00080 00081 virtual void setMessageAvailableListener(cms::MessageAvailableListener* listener); 00082 00083 virtual cms::MessageAvailableListener* getMessageAvailableListener() const; 00084 00085 virtual std::string getMessageSelector() const; 00086 00087 virtual void setMessageTransformer(cms::MessageTransformer* transformer); 00088 00089 virtual cms::MessageTransformer* getMessageTransformer() const; 00090 00091 public: 00092 00097 const Pointer<commands::ConsumerInfo>& getConsumerInfo() const; 00098 00103 const Pointer<commands::ConsumerId>& getConsumerId() const; 00104 00108 bool isClosed() const; 00109 00113 int getMessageAvailableCount() const; 00114 00124 void setRedeliveryPolicy(RedeliveryPolicy* policy); 00125 00132 RedeliveryPolicy* getRedeliveryPolicy() const; 00133 00140 decaf::lang::Exception* getFailureError() const; 00141 00148 long long getOptimizedAckScheduledAckInterval() const; 00149 00158 void setOptimizedAckScheduledAckInterval(long long value); 00159 00163 bool isOptimizeAcknowledge() const; 00164 00171 void setOptimizeAcknowledge(bool value); 00172 00173 }; 00174 00175 }} 00176 00177 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONSUMER_H_*/
1.6.1