|
activemq-cpp-3.3.0
|
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 00018 #ifndef ACTIVEMQ_CMSUTIL_CACHEDCONSUMER_H_ 00019 #define ACTIVEMQ_CMSUTIL_CACHEDCONSUMER_H_ 00020 00021 #include <cms/MessageConsumer.h> 00022 #include <activemq/util/Config.h> 00023 00024 namespace activemq { 00025 namespace cmsutil { 00026 00030 class AMQCPP_API CachedConsumer : public cms::MessageConsumer { 00031 private: 00032 00033 cms::MessageConsumer* consumer; 00034 00035 private: 00036 00037 CachedConsumer( const CachedConsumer& ); 00038 CachedConsumer& operator= ( const CachedConsumer& ); 00039 00040 public: 00041 00042 CachedConsumer( cms::MessageConsumer* consumer ) : consumer( consumer ) { 00043 } 00044 00045 virtual ~CachedConsumer() throw() {} 00046 00051 virtual void close() { 00052 // Do nothing. 00053 } 00054 00055 virtual cms::Message* receive() { 00056 return consumer->receive(); 00057 } 00058 00059 virtual cms::Message* receive( int millisecs ) { 00060 return consumer->receive(millisecs); 00061 } 00062 00063 virtual cms::Message* receiveNoWait() { 00064 return consumer->receiveNoWait(); 00065 } 00066 00067 virtual void setMessageListener( cms::MessageListener* listener ) { 00068 consumer->setMessageListener( listener ); 00069 } 00070 00071 virtual cms::MessageListener* getMessageListener() const { 00072 return consumer->getMessageListener(); 00073 } 00074 00075 virtual std::string getMessageSelector() const { 00076 return consumer->getMessageSelector(); 00077 } 00078 00079 }; 00080 00081 }} 00082 00083 #endif /*ACTIVEMQ_CMSUTIL_CACHEDCONSUMER_H_*/