activemq-cpp-3.9.5
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 getConnectResponseTimeout() const;
388 
395  void setConnectResponseTimeout(unsigned int connectResponseTimeout);
396 
401  unsigned int getCloseTimeout() const;
402 
407  void setCloseTimeout(unsigned int timeout);
408 
416  unsigned int getProducerWindowSize() const;
417 
424  void setProducerWindowSize(unsigned int windowSize);
425 
430  bool isMessagePrioritySupported() const;
431 
439  void setMessagePrioritySupported(bool value);
440 
446  bool isUseRetroactiveConsumer() const;
447 
456  void setUseRetroactiveConsumer(bool useRetroactiveConsumer);
457 
463  bool isExclusiveConsumer() const;
464 
472  void setExclusiveConsumer(bool exclusiveConsumer);
473 
480  bool isWatchTopicAdvisories() const;
481 
489  void setWatchTopicAdvisories(bool value);
490 
499  int getAuditDepth() const;
500 
510  void setAuditDepth(int auditDepth);
511 
517  int getAuditMaximumProducerNumber() const;
518 
525  void setAuditMaximumProducerNumber(int auditMaximumProducerNumber);
526 
539  bool isCheckForDuplicates() const;
540 
554  void setCheckForDuplicates(bool checkForDuplicates);
555 
563  bool isTransactedIndividualAck() const;
564 
573  void setTransactedIndividualAck(bool transactedIndividualAck);
574 
581  bool isNonBlockingRedelivery() const;
582 
591  void setNonBlockingRedelivery(bool nonBlockingRedelivery);
592 
598  long long getConsumerFailoverRedeliveryWaitPeriod() const;
599 
606  void setConsumerFailoverRedeliveryWaitPeriod(long long value);
607 
611  bool isOptimizeAcknowledge() const;
612 
619  void setOptimizeAcknowledge(bool optimizeAcknowledge);
620 
626  long long getOptimizeAcknowledgeTimeOut() const;
627 
634  void setOptimizeAcknowledgeTimeOut(long long optimizeAcknowledgeTimeOut);
635 
644  long long getOptimizedAckScheduledAckInterval() const;
645 
655  void setOptimizedAckScheduledAckInterval(long long optimizedAckScheduledAckInterval);
656 
662  bool isAlwaysSessionAsync() const;
663 
673  void setAlwaysSessionAsync(bool alwaysSessionAsync);
674 
678  bool isConsumerExpiryCheckEnabled();
679 
687  void setConsumerExpiryCheckEnabled(bool consumerExpiryCheckEnabled);
688 
689  public:
690 
707  static cms::Connection* createConnection(const std::string& uri, const std::string& username,
708  const std::string& password, const std::string& clientId = "");
709 
710  protected:
711 
724  virtual ActiveMQConnection* createActiveMQConnection(const Pointer<transport::Transport>& transport,
725  const Pointer<decaf::util::Properties>& properties);
726 
727  private:
728 
729  cms::Connection* doCreateConnection(const decaf::net::URI& uri, const std::string& username,
730  const std::string& password, const std::string& clientId);
731 
732  void configureConnection(ActiveMQConnection* connection);
733 
734  };
735 
736 }}
737 
738 #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'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:37
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
Decaf'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:61