|
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 #ifndef _CMS_SESSION_H_ 00018 #define _CMS_SESSION_H_ 00019 00020 #include <cms/Config.h> 00021 #include <cms/Closeable.h> 00022 #include <cms/Message.h> 00023 #include <cms/TextMessage.h> 00024 #include <cms/BytesMessage.h> 00025 #include <cms/MapMessage.h> 00026 #include <cms/StreamMessage.h> 00027 #include <cms/MessageProducer.h> 00028 #include <cms/MessageConsumer.h> 00029 #include <cms/Topic.h> 00030 #include <cms/Queue.h> 00031 #include <cms/QueueBrowser.h> 00032 #include <cms/TemporaryTopic.h> 00033 #include <cms/TemporaryQueue.h> 00034 #include <cms/CMSException.h> 00035 00036 namespace cms{ 00037 00097 class CMS_API Session : public Closeable { 00098 public: 00099 00100 enum AcknowledgeMode { 00101 00109 AUTO_ACKNOWLEDGE, 00110 00120 DUPS_OK_ACKNOWLEDGE, 00121 00126 CLIENT_ACKNOWLEDGE, 00127 00131 SESSION_TRANSACTED, 00132 00138 INDIVIDUAL_ACKNOWLEDGE 00139 00140 }; 00141 00142 public: 00143 00144 virtual ~Session() throw(); 00145 00152 virtual void close() = 0; 00153 00161 virtual void commit() = 0; 00162 00170 virtual void rollback() = 0; 00171 00192 virtual void recover() = 0; 00193 00205 virtual MessageConsumer* createConsumer( const Destination* destination ) = 0; 00206 00222 virtual MessageConsumer* createConsumer( const Destination* destination, 00223 const std::string& selector ) = 0; 00224 00244 virtual MessageConsumer* createConsumer( const Destination* destination, 00245 const std::string& selector, 00246 bool noLocal ) = 0; 00247 00271 virtual MessageConsumer* createDurableConsumer( const Topic* destination, 00272 const std::string& name, 00273 const std::string& selector, 00274 bool noLocal = false ) = 0; 00275 00287 virtual MessageProducer* createProducer( const Destination* destination = NULL ) = 0; 00288 00299 virtual QueueBrowser* createBrowser( const cms::Queue* queue ) = 0; 00300 00313 virtual QueueBrowser* createBrowser( const cms::Queue* queue, const std::string& selector ) = 0; 00314 00324 virtual Queue* createQueue( const std::string& queueName ) = 0; 00325 00335 virtual Topic* createTopic( const std::string& topicName ) = 0; 00336 00344 virtual TemporaryQueue* createTemporaryQueue() = 0; 00345 00351 virtual TemporaryTopic* createTemporaryTopic() = 0; 00352 00358 virtual Message* createMessage() = 0; 00359 00365 virtual BytesMessage* createBytesMessage() = 0; 00366 00377 virtual BytesMessage* createBytesMessage( const unsigned char* bytes, int bytesSize ) = 0; 00378 00384 virtual StreamMessage* createStreamMessage() = 0; 00385 00391 virtual TextMessage* createTextMessage() = 0; 00392 00401 virtual TextMessage* createTextMessage( const std::string& text ) = 0; 00402 00408 virtual MapMessage* createMapMessage() = 0; 00409 00417 virtual AcknowledgeMode getAcknowledgeMode() const = 0; 00418 00426 virtual bool isTransacted() const = 0; 00427 00444 virtual void unsubscribe( const std::string& name ) = 0; 00445 00446 }; 00447 00448 } 00449 00450 #endif /*_CMS_SESSION_H_*/