activemq-cpp-3.6.0
ActiveMQSession.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 _ACTIVEMQ_CORE_ACTIVEMQSESSION_H_
18 #define _ACTIVEMQ_CORE_ACTIVEMQSESSION_H_
19 
20 #include <cms/Session.h>
21 #include <cms/ExceptionListener.h>
22 
23 #include <activemq/util/Config.h>
28 
29 #include <decaf/lang/Pointer.h>
30 
31 #include <string>
32 #include <memory>
33 
34 namespace activemq{
35 namespace core{
36 
39 
40  class ActiveMQConnection;
41 
42  class AMQCPP_API ActiveMQSession : public virtual cms::Session {
43  protected:
44 
46 
47  private:
48 
50  ActiveMQSession& operator=(const ActiveMQSession&);
51 
52  public:
53 
55 
56  virtual ~ActiveMQSession();
57 
61  virtual void start();
62 
66  virtual void stop();
67 
72  bool isStarted() const {
73  return this->kernel->isStarted();
74  }
75 
76  public: // Implements Methods
77 
78  virtual void close();
79 
80  virtual void commit();
81 
82  virtual void rollback();
83 
84  virtual void recover();
85 
86  virtual cms::MessageConsumer* createConsumer(const cms::Destination* destination);
87 
88  virtual cms::MessageConsumer* createConsumer(const cms::Destination* destination,
89  const std::string& selector);
90 
91  virtual cms::MessageConsumer* createConsumer(const cms::Destination* destination,
92  const std::string& selector,
93  bool noLocal);
94 
95  virtual cms::MessageConsumer* createDurableConsumer(const cms::Topic* destination,
96  const std::string& name,
97  const std::string& selector,
98  bool noLocal = false);
99 
100  virtual cms::MessageProducer* createProducer(const cms::Destination* destination);
101 
102  virtual cms::QueueBrowser* createBrowser(const cms::Queue* queue);
103 
104  virtual cms::QueueBrowser* createBrowser(const cms::Queue* queue, const std::string& selector);
105 
106  virtual cms::Queue* createQueue(const std::string& queueName);
107 
108  virtual cms::Topic* createTopic(const std::string& topicName);
109 
110  virtual cms::TemporaryQueue* createTemporaryQueue();
111 
112  virtual cms::TemporaryTopic* createTemporaryTopic();
113 
114  virtual cms::Message* createMessage();
115 
116  virtual cms::BytesMessage* createBytesMessage();
117 
118  virtual cms::BytesMessage* createBytesMessage(const unsigned char* bytes, int bytesSize);
119 
120  virtual cms::StreamMessage* createStreamMessage();
121 
122  virtual cms::TextMessage* createTextMessage();
123 
124  virtual cms::TextMessage* createTextMessage(const std::string& text);
125 
126  virtual cms::MapMessage* createMapMessage();
127 
129  return this->kernel->getAcknowledgeMode();
130  }
131 
132  virtual bool isTransacted() const {
133  return this->kernel->isTransacted();
134  }
135 
136  virtual void unsubscribe(const std::string& name);
137 
138  public: // ActiveMQSession specific Methods
139 
148  return this->kernel->getExceptionListener();
149  }
150 
158  virtual void setMessageTransformer(cms::MessageTransformer* transformer) {
159  this->kernel->setMessageTransformer(transformer);
160  }
161 
168  return this->kernel->getMessageTransformer();
169  }
170 
177  return this->kernel->getSessionInfo();
178  }
179 
186  return this->kernel->getSessionId();
187  }
188 
193  return this->kernel->getConnection();
194  }
195 
196  };
197 
198 }}
199 
200 #endif /*_ACTIVEMQ_CORE_ACTIVEMQSESSION_H_*/