activemq-cpp-3.9.5
TcpTransport.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
18#ifndef _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_
19#define _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_
20
25#include <decaf/net/Socket.h>
26#include <decaf/net/URI.h>
28#include <decaf/lang/Pointer.h>
33#include <memory>
34
35namespace activemq {
36namespace transport {
37namespace tcp {
38
39 using decaf::lang::Pointer;
40
41 class TcpTransportImpl;
42
48 class AMQCPP_API TcpTransport: public TransportFilter {
49 private:
50
51 TcpTransportImpl* impl;
52
53 private:
54
55 TcpTransport(const TcpTransport&);
56 TcpTransport& operator=(const TcpTransport&);
57
58 public:
59
70
71 virtual ~TcpTransport();
72
73 void setConnectTimeout(int soConnectTimeout);
74 int getConnectTimeout() const;
75
76 void setOutputBufferSize(int outputBufferSize);
78
79 void setInputBufferSize(int inputBufferSize);
80 int getInputBufferSize() const;
81
82 void setTrace(bool trace);
83 bool isTrace() const;
84
85 void setLinger(int soLinger);
86 int getLinger() const;
87
88 void setKeepAlive(bool soKeepAlive);
89 bool isKeepAlive() const;
90
91 void setReceiveBufferSize(int soReceiveBufferSize);
93
94 void setSendBufferSize(int soSendBufferSize);
95 int getSendBufferSize() const;
96
97 void setTcpNoDelay(bool tcpNoDelay);
98 bool isTcpNoDelay() const;
99
100 public: // Transport Methods
101
102 virtual bool isFaultTolerant() const {
103 return false;
104 }
105
106 virtual bool isConnected() const;
107
108 protected:
109
111
112 virtual void beforeNextIsStarted();
113
114 virtual void afterNextIsStopped();
115
116 virtual void doClose();
117
122 void connect();
123
133
147 virtual void configureSocket(decaf::net::Socket* socket);
148
149 };
150
151}}}
152
153#endif /*_ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_*/
#define AMQCPP_API
Definition Config.h:30
Pointer< Transport > next
The transport that this filter wraps around.
Definition TransportFilter.h:54
void setConnectTimeout(int soConnectTimeout)
void connect()
Creates a Socket and configures it before attempting to connect to the location specified by the URI ...
virtual void configureSocket(decaf::net::Socket *socket)
Using options from configuration URI, configure the socket options before the Socket instance is conn...
virtual bool isFaultTolerant() const
Is this Transport fault tolerant, meaning that it will reconnect to a broker on disconnect.
Definition TcpTransport.h:102
void setReceiveBufferSize(int soReceiveBufferSize)
virtual void beforeNextIsStarted()
Subclasses can override this method to do their own startup work.
void setKeepAlive(bool soKeepAlive)
TcpTransport(const Pointer< Transport > next, const decaf::net::URI &location)
Creates a new instance of a TcpTransport, the transport is left unconnected and is in a unusable stat...
void setOutputBufferSize(int outputBufferSize)
decaf::net::URI getLocation() const
virtual void afterNextIsStopped()
Subclasses can override this method to do their own stop work.
virtual bool isConnected() const
Is the Transport Connected to its Broker.
void setSendBufferSize(int soSendBufferSize)
void setInputBufferSize(int inputBufferSize)
virtual void doClose()
Subclasses can override this method to do their own close work.
virtual decaf::net::Socket * createSocket()
Create an unconnected Socket instance to be used by the transport to communicate with the broker.
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
Definition Socket.h:44
This class represents an instance of a URI as defined by RFC 2396.
Definition URI.h:37
Definition SslTransport.h:27
Definition AbstractTransportFactory.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24