activemq-cpp-3.8.2
ActiveMQConnectionFactory.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_ACTIVEMQCONNECTIONFACTORY_H_
18 #define _ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_H_
19 
20 #include <activemq/util/Config.h>
21 
22 #include <cms/ConnectionFactory.h>
23 #include <cms/Connection.h>
24 
26 
27 #include <decaf/net/URI.h>
28 #include <decaf/util/Properties.h>
29 
30 namespace activemq{
31 namespace core{
32 
34 
35  class ActiveMQConnection;
36  class FactorySettings;
37  class PrefetchPolicy;
38  class RedeliveryPolicy;
39 
41  public:
42 
43  // Default Broker URI if none specified 'failover:tcp://localhost:61616'
44  static const std::string DEFAULT_URI;
45 
46  private:
47 
48  FactorySettings* settings;
49 
50  private:
51 
54 
55  public:
56 
58 
69  ActiveMQConnectionFactory(const std::string& uri,
70  const std::string& username = "",
71  const std::string& password = "");
72 
84  const std::string& username = "",
85  const std::string& password = "");
86 
87  virtual ~ActiveMQConnectionFactory();
88 
99  virtual cms::Connection* createConnection();
100 
120  virtual cms::Connection* createConnection(const std::string& username,
121  const std::string& password);
122 
145  virtual cms::Connection* createConnection(const std::string& username,
146  const std::string& password,
147  const std::string& clientId);
148 
149  public: // Configuration Options
150 
155  void setUsername(const std::string& username);
156 
162  const std::string& getUsername() const;
163 
168  void setPassword(const std::string& password);
169 
175  const std::string& getPassword() const;
176 
181  std::string getClientId() const;
182 
187  void setClientId(const std::string& clientId);
188 
195  void setBrokerURI(const std::string& uri);
196 
203  void setBrokerURI(const decaf::net::URI& uri);
204 
210  const decaf::net::URI& getBrokerURI() const;
211 
220  virtual void setExceptionListener(cms::ExceptionListener* listener);
221 
228  virtual cms::ExceptionListener* getExceptionListener() const;
229 
237  virtual void setMessageTransformer(cms::MessageTransformer* transformer);
238 
244  virtual cms::MessageTransformer* getMessageTransformer() const;
245 
254  void setPrefetchPolicy(PrefetchPolicy* policy);
255 
261  PrefetchPolicy* getPrefetchPolicy() const;
262 
271  void setRedeliveryPolicy(RedeliveryPolicy* policy);
272 
278  RedeliveryPolicy* getRedeliveryPolicy() const;
279 
283  bool isDispatchAsync() const;
284 
293  void setDispatchAsync(bool value);
294 
300  bool isAlwaysSyncSend() const;
301 
307  void setAlwaysSyncSend(bool value);
308 
313  bool isUseAsyncSend() const;
314 
319  void setUseAsyncSend(bool value);
320 
327  bool isSendAcksAsync() const;
328 
336  void setSendAcksAsync(bool sendAcksAsync);
337 
342  bool isUseCompression() const;
343 
350  void setUseCompression(bool value);
351 
361  void setCompressionLevel(int value);
362 
368  int getCompressionLevel() const;
369 
374  unsigned int getSendTimeout() const;
375 
381  void setSendTimeout(unsigned int timeout);
382 
387  unsigned int getCloseTimeout() const;
388 
393  void setCloseTimeout(unsigned int timeout);
394 
402  unsigned int getProducerWindowSize() const;
403 
410  void setProducerWindowSize(unsigned int windowSize);
411 
416  bool isMessagePrioritySupported() const;
417 
425  void setMessagePrioritySupported(bool value);
426 
432  bool isUseRetroactiveConsumer() const;
433 
442  void setUseRetroactiveConsumer(bool useRetroactiveConsumer);
443 
449  bool isExclusiveConsumer() const;
450 
458  void setExclusiveConsumer(bool exclusiveConsumer);
459 
466  bool isWatchTopicAdvisories() const;
467 
475  void setWatchTopicAdvisories(bool value);
476 
485  int getAuditDepth() const;
486 
496  void setAuditDepth(int auditDepth);
497 
503  int getAuditMaximumProducerNumber() const;
504 
511  void setAuditMaximumProducerNumber(int auditMaximumProducerNumber);
512 
525  bool isCheckForDuplicates() const;
526 
540  void setCheckForDuplicates(bool checkForDuplicates);
541 
549  bool isTransactedIndividualAck() const;
550 
559  void setTransactedIndividualAck(bool transactedIndividualAck);
560 
567  bool isNonBlockingRedelivery() const;
568 
577  void setNonBlockingRedelivery(bool nonBlockingRedelivery);
578 
584  long long getConsumerFailoverRedeliveryWaitPeriod() const;
585 
592  void setConsumerFailoverRedeliveryWaitPeriod(long long value);
593 
597  bool isOptimizeAcknowledge() const;
598 
605  void setOptimizeAcknowledge(bool optimizeAcknowledge);
606 
612  long long getOptimizeAcknowledgeTimeOut() const;
613 
620  void setOptimizeAcknowledgeTimeOut(long long optimizeAcknowledgeTimeOut);
621 
630  long long getOptimizedAckScheduledAckInterval() const;
631 
641  void setOptimizedAckScheduledAckInterval(long long optimizedAckScheduledAckInterval);
642 
643  public:
644 
661  static cms::Connection* createConnection(const std::string& uri, const std::string& username,
662  const std::string& password, const std::string& clientId = "");
663 
664  protected:
665 
678  virtual ActiveMQConnection* createActiveMQConnection(const Pointer<transport::Transport>& transport,
679  const Pointer<decaf::util::Properties>& properties);
680 
681  private:
682 
683  cms::Connection* doCreateConnection(const decaf::net::URI& uri, const std::string& username,
684  const std::string& password, const std::string& clientId);
685 
686  void configureConnection(ActiveMQConnection* connection);
687 
688  };
689 
690 }}
691 
692 #endif /*_ACTIVEMQ_CORE_ACTIVEMQCONNECTIONFACTORY_H_*/
Provides an interface for clients to transform cms::Message objects inside the CMS MessageProducer an...
Definition: MessageTransformer.h:37
Defines the interface for a factory that creates connection objects, the Connection objects returned ...
Definition: ConnectionFactory.h:41
Interface for a RedeliveryPolicy object that controls how message Redelivery is handled in ActiveMQ-C...
Definition: RedeliveryPolicy.h:34
#define AMQCPP_API
Definition: Config.h:30
If a CMS provider detects a serious problem, it notifies the client application through an ExceptionL...
Definition: ExceptionListener.h:37
The client&#39;s connection to its provider.
Definition: Connection.h:70
Definition: ActiveMQConnectionFactory.h:40
This class represents an instance of a URI as defined by RFC 2396.
Definition: URI.h:36
Interface for a Policy object that controls message Prefetching on various destination types in Activ...
Definition: PrefetchPolicy.h:34
static const std::string DEFAULT_URI
Definition: ActiveMQConnectionFactory.h:44
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
Concrete connection used for all connectors to the ActiveMQ broker.
Definition: ActiveMQConnection.h:60