activemq-cpp-3.3.0

src/main/activemq/cmsutil/CachedProducer.h

Go to the documentation of this file.
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_CACHEDPRODUCER_H_
00019 #define ACTIVEMQ_CMSUTIL_CACHEDPRODUCER_H_
00020 
00021 #include <cms/MessageProducer.h>
00022 #include <activemq/util/Config.h>
00023 
00024 namespace activemq {
00025 namespace cmsutil {
00026 
00030     class AMQCPP_API CachedProducer : public cms::MessageProducer {
00031     private:
00032 
00033         cms::MessageProducer* producer;
00034 
00035     private:
00036 
00037         CachedProducer( const CachedProducer& );
00038         CachedProducer& operator= ( const CachedProducer& );
00039 
00040     public:
00041 
00042         CachedProducer( cms::MessageProducer* producer ) : producer( producer ) {
00043         }
00044 
00045         virtual ~CachedProducer() throw() {}
00046 
00051         virtual void close() {
00052             // Do nothing.
00053         }
00054 
00055         virtual void send( cms::Message* message ) {
00056             producer->send( message );
00057         }
00058 
00059         virtual void send( cms::Message* message, int deliveryMode,
00060                            int priority, long long timeToLive ) {
00061 
00062             producer->send( message, deliveryMode, priority, timeToLive );
00063         }
00064 
00065 
00066         virtual void send( const cms::Destination* destination,
00067                            cms::Message* message ) {
00068 
00069             producer->send( destination, message );
00070         }
00071 
00072         virtual void send( const cms::Destination* destination,
00073                            cms::Message* message, int deliveryMode,
00074                            int priority, long long timeToLive ) {
00075 
00076             producer->send( destination, message, deliveryMode, priority, timeToLive );
00077         }
00078 
00079         virtual void setDeliveryMode( int mode ) {
00080             producer->setDeliveryMode( mode );
00081         }
00082 
00083         virtual int getDeliveryMode() const {
00084             return producer->getDeliveryMode();
00085         }
00086 
00087         virtual void setDisableMessageID( bool value ) {
00088             producer->setDisableMessageID( value );
00089         }
00090 
00091         virtual bool getDisableMessageID() const {
00092             return producer->getDisableMessageID();
00093         }
00094 
00095         virtual void setDisableMessageTimeStamp( bool value ) {
00096             producer->setDisableMessageTimeStamp( value );
00097         }
00098 
00099         virtual bool getDisableMessageTimeStamp() const {
00100             return producer->getDisableMessageTimeStamp();
00101         }
00102 
00103         virtual void setPriority( int priority ) {
00104             producer->setPriority( priority );
00105         }
00106 
00107         virtual int getPriority() const {
00108             return producer->getPriority();
00109         }
00110 
00111         virtual void setTimeToLive( long long time ) {
00112             producer->setTimeToLive( time );
00113         }
00114 
00115         virtual long long getTimeToLive() const {
00116             return producer->getTimeToLive();
00117         }
00118 
00119     };
00120 
00121 }}
00122 
00123 #endif /*ACTIVEMQ_CMSUTIL_CACHEDPRODUCER_H_*/