activemq-cpp-3.8.2
CmsAccessor.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_CMSUTIL_CMSACCESSOR_H_
18 #define _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_
19 
20 #include <cms/ConnectionFactory.h>
22 #include <activemq/util/Config.h>
23 
24 namespace activemq {
25 namespace cmsutil {
26 
40  private:
41 
42  ResourceLifecycleManager resourceLifecycleManager;
43 
44  cms::ConnectionFactory* connectionFactory;
45 
46  cms::Session::AcknowledgeMode sessionAcknowledgeMode;
47 
48  protected:
49 
50  CmsAccessor(const CmsAccessor&);
51  CmsAccessor& operator=(const CmsAccessor&);
52 
53  public:
54 
55  CmsAccessor();
56 
57  virtual ~CmsAccessor();
58 
60  return &resourceLifecycleManager;
61  }
62 
64  return &resourceLifecycleManager;
65  }
66 
70  virtual void setConnectionFactory(cms::ConnectionFactory* connectionFactory) {
71  this->connectionFactory = connectionFactory;
72  }
73 
79  return this->connectionFactory;
80  }
81 
87  return this->connectionFactory;
88  }
89 
98  virtual void setSessionAcknowledgeMode(cms::Session::AcknowledgeMode sessionAcknowledgeMode) {
99  this->sessionAcknowledgeMode = sessionAcknowledgeMode;
100  }
101 
108  return this->sessionAcknowledgeMode;
109  }
110 
111  protected:
112 
120  virtual void init();
121 
128  virtual void destroy() {
129  resourceLifecycleManager.destroy();
130  }
131 
140  virtual cms::Connection* createConnection();
141 
153  virtual cms::Session* createSession(cms::Connection* con);
154 
160  virtual void checkConnectionFactory();
161 
162  };
163 
164 }}
165 
166 #endif /* _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_ */
virtual ResourceLifecycleManager * getResourceLifecycleManager()
Definition: CmsAccessor.h:59
Defines the interface for a factory that creates connection objects, the Connection objects returned ...
Definition: ConnectionFactory.h:41
Base class for activemq.cmsutil.CmsTemplate and other CMS-accessing gateway helpers, defining common properties such as the CMS cms.ConnectionFactory to operate on.
Definition: CmsAccessor.h:39
#define AMQCPP_API
Definition: Config.h:30
AcknowledgeMode
Definition: Session.h:108
virtual void setConnectionFactory(cms::ConnectionFactory *connectionFactory)
Set the ConnectionFactory to use for obtaining CMS Connections.
Definition: CmsAccessor.h:70
virtual cms::Session::AcknowledgeMode getSessionAcknowledgeMode() const
Return the acknowledgment mode for CMS sessions.
Definition: CmsAccessor.h:107
virtual const cms::ConnectionFactory * getConnectionFactory() const
Return the ConnectionFactory that this accessor uses for obtaining CMS Connections.
Definition: CmsAccessor.h:78
virtual cms::ConnectionFactory * getConnectionFactory()
Return the ConnectionFactory that this accessor uses for obtaining CMS Connections.
Definition: CmsAccessor.h:86
The client&#39;s connection to its provider.
Definition: Connection.h:70
void destroy()
Closes and destroys the contained CMS resources.
A Session object is a single-threaded context for producing and consuming messages.
Definition: Session.h:105
Manages the lifecycle of a set of CMS resources.
Definition: ResourceLifecycleManager.h:37
virtual const ResourceLifecycleManager * getResourceLifecycleManager() const
Definition: CmsAccessor.h:63
virtual void setSessionAcknowledgeMode(cms::Session::AcknowledgeMode sessionAcknowledgeMode)
Set the CMS acknowledgment mode that is used when creating a CMS Session to send a message...
Definition: CmsAccessor.h:98
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
virtual void destroy()
Shuts down this object and destroys any allocated resources.
Definition: CmsAccessor.h:128