activemq-cpp-3.8.2
Session.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 #ifndef _CMS_SESSION_H_
18 #define _CMS_SESSION_H_
19 
20 #include <cms/Config.h>
21 #include <cms/Closeable.h>
22 #include <cms/Startable.h>
23 #include <cms/Stoppable.h>
24 #include <cms/Message.h>
25 #include <cms/TextMessage.h>
26 #include <cms/BytesMessage.h>
27 #include <cms/MapMessage.h>
28 #include <cms/StreamMessage.h>
29 #include <cms/MessageProducer.h>
30 #include <cms/MessageConsumer.h>
31 #include <cms/Topic.h>
32 #include <cms/Queue.h>
33 #include <cms/QueueBrowser.h>
34 #include <cms/TemporaryTopic.h>
35 #include <cms/TemporaryQueue.h>
36 #include <cms/CMSException.h>
37 
38 namespace cms {
39 
40  class MessageTransformer;
41 
105  class CMS_API Session : public Closeable, public Startable, public Stoppable {
106  public:
107 
109 
118 
129 
135 
140 
146  INDIVIDUAL_ACKNOWLEDGE
147 
148  };
149 
150  public:
151 
152  virtual ~Session();
153 
160  virtual void close() = 0;
161 
169  virtual void commit() = 0;
170 
178  virtual void rollback() = 0;
179 
200  virtual void recover() = 0;
201 
213  virtual MessageConsumer* createConsumer(const Destination* destination) = 0;
214 
230  virtual MessageConsumer* createConsumer(const Destination* destination, const std::string& selector) = 0;
231 
251  virtual MessageConsumer* createConsumer(const Destination* destination, const std::string& selector, bool noLocal) = 0;
252 
276  virtual MessageConsumer* createDurableConsumer(const Topic* destination, const std::string& name, const std::string& selector, bool noLocal = false) = 0;
277 
289  virtual MessageProducer* createProducer(const Destination* destination = NULL) = 0;
290 
301  virtual QueueBrowser* createBrowser(const cms::Queue* queue) = 0;
302 
315  virtual QueueBrowser* createBrowser(const cms::Queue* queue, const std::string& selector) = 0;
316 
326  virtual Queue* createQueue(const std::string& queueName) = 0;
327 
337  virtual Topic* createTopic(const std::string& topicName) = 0;
338 
346  virtual TemporaryQueue* createTemporaryQueue() = 0;
347 
353  virtual TemporaryTopic* createTemporaryTopic() = 0;
354 
360  virtual Message* createMessage() = 0;
361 
367  virtual BytesMessage* createBytesMessage() = 0;
368 
379  virtual BytesMessage* createBytesMessage(const unsigned char* bytes, int bytesSize) = 0;
380 
386  virtual StreamMessage* createStreamMessage() = 0;
387 
393  virtual TextMessage* createTextMessage() = 0;
394 
403  virtual TextMessage* createTextMessage(const std::string& text) = 0;
404 
410  virtual MapMessage* createMapMessage() = 0;
411 
419  virtual AcknowledgeMode getAcknowledgeMode() const = 0;
420 
428  virtual bool isTransacted() const = 0;
429 
446  virtual void unsubscribe(const std::string& name) = 0;
447 
459  virtual void setMessageTransformer(cms::MessageTransformer* transformer) = 0;
460 
466  virtual cms::MessageTransformer* getMessageTransformer() const = 0;
467 
468  };
469 
470 }
471 
472 #endif /*_CMS_SESSION_H_*/
An interface encapsulating a provider-specific topic name.
Definition: Topic.h:36
Provides an interface for clients to transform cms::Message objects inside the CMS MessageProducer an...
Definition: MessageTransformer.h:37
With this acknowledgment mode, the session automatically acknowledges a client&#39;s receipt of a message...
Definition: Session.h:128
Root of all messages.
Definition: Message.h:88
Defines a Temporary Topic based Destination.
Definition: TemporaryTopic.h:39
A Destination object encapsulates a provider-specific address.
Definition: Destination.h:39
AcknowledgeMode
Definition: Session.h:108
#define NULL
Definition: Config.h:33
With this acknowledgment mode, the session automatically acknowledges a client&#39;s receipt of a message...
Definition: Session.h:117
Interface for a class that implements the close method.
Definition: Closeable.h:35
This class implements in interface for browsing the messages in a Queue without removing them...
Definition: QueueBrowser.h:53
Messages will be consumed when the transaction commits.
Definition: Session.h:139
A BytesMessage object is used to send a message containing a stream of unsigned bytes.
Definition: BytesMessage.h:66
#define CMS_API
Definition: Config.h:31
Defines a Temporary Queue based Destination.
Definition: TemporaryQueue.h:39
A Session object is a single-threaded context for producing and consuming messages.
Definition: Session.h:105
With this acknowledgment mode, the client acknowledges a consumed message by calling the message&#39;s ac...
Definition: Session.h:134
A MapMessage object is used to send a set of name-value pairs.
Definition: MapMessage.h:71
Interface for a StreamMessage.
Definition: StreamMessage.h:61
Interface for a class that implements the stop method.
Definition: Stoppable.h:36
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: DestinationResolver.h:23
A client uses a MessageProducer object to send messages to a Destination.
Definition: MessageProducer.h:60
A client uses a MessageConsumer to received messages from a destination.
Definition: MessageConsumer.h:63
Interface for a class that implements the start method.
Definition: Startable.h:36
Interface for a text message.
Definition: TextMessage.h:41
An interface encapsulating a provider-specific queue name.
Definition: Queue.h:37