activemq-cpp-3.4.0

src/main/cms/Session.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 #ifndef _CMS_SESSION_H_
00018 #define _CMS_SESSION_H_
00019 
00020 #include <cms/Config.h>
00021 #include <cms/Closeable.h>
00022 #include <cms/Startable.h>
00023 #include <cms/Stoppable.h>
00024 #include <cms/Message.h>
00025 #include <cms/TextMessage.h>
00026 #include <cms/BytesMessage.h>
00027 #include <cms/MapMessage.h>
00028 #include <cms/StreamMessage.h>
00029 #include <cms/MessageProducer.h>
00030 #include <cms/MessageConsumer.h>
00031 #include <cms/Topic.h>
00032 #include <cms/Queue.h>
00033 #include <cms/QueueBrowser.h>
00034 #include <cms/TemporaryTopic.h>
00035 #include <cms/TemporaryQueue.h>
00036 #include <cms/CMSException.h>
00037 
00038 namespace cms{
00039 
00103     class CMS_API Session : public Closeable, public Startable, public Stoppable {
00104     public:
00105 
00106         enum AcknowledgeMode {
00107 
00115             AUTO_ACKNOWLEDGE,
00116 
00126             DUPS_OK_ACKNOWLEDGE,
00127 
00132             CLIENT_ACKNOWLEDGE,
00133 
00137             SESSION_TRANSACTED,
00138 
00144             INDIVIDUAL_ACKNOWLEDGE
00145 
00146         };
00147 
00148     public:
00149 
00150         virtual ~Session() throw();
00151 
00158         virtual void close() = 0;
00159 
00167         virtual void commit() = 0;
00168 
00176         virtual void rollback() = 0;
00177 
00198         virtual void recover() = 0;
00199 
00211         virtual MessageConsumer* createConsumer( const Destination* destination ) = 0;
00212 
00228         virtual MessageConsumer* createConsumer( const Destination* destination,
00229                                                  const std::string& selector ) = 0;
00230 
00250         virtual MessageConsumer* createConsumer( const Destination* destination,
00251                                                  const std::string& selector,
00252                                                  bool noLocal ) = 0;
00253 
00277         virtual MessageConsumer* createDurableConsumer( const Topic* destination,
00278                                                         const std::string& name,
00279                                                         const std::string& selector,
00280                                                         bool noLocal = false ) = 0;
00281 
00293         virtual MessageProducer* createProducer( const Destination* destination = NULL ) = 0;
00294 
00305         virtual QueueBrowser* createBrowser( const cms::Queue* queue ) = 0;
00306 
00319         virtual QueueBrowser* createBrowser( const cms::Queue* queue, const std::string& selector ) = 0;
00320 
00330         virtual Queue* createQueue( const std::string& queueName ) = 0;
00331 
00341         virtual Topic* createTopic( const std::string& topicName ) = 0;
00342 
00350         virtual TemporaryQueue* createTemporaryQueue() = 0;
00351 
00357         virtual TemporaryTopic* createTemporaryTopic() = 0;
00358 
00364         virtual Message* createMessage() = 0;
00365 
00371         virtual BytesMessage* createBytesMessage() = 0;
00372 
00383         virtual BytesMessage* createBytesMessage( const unsigned char* bytes, int bytesSize ) = 0;
00384 
00390         virtual StreamMessage* createStreamMessage() = 0;
00391 
00397         virtual TextMessage* createTextMessage() = 0;
00398 
00407         virtual TextMessage* createTextMessage( const std::string& text ) = 0;
00408 
00414         virtual MapMessage* createMapMessage() = 0;
00415 
00423         virtual AcknowledgeMode getAcknowledgeMode() const = 0;
00424 
00432         virtual bool isTransacted() const = 0;
00433 
00450         virtual void unsubscribe( const std::string& name ) = 0;
00451 
00452     };
00453 
00454 }
00455 
00456 #endif /*_CMS_SESSION_H_*/