8
8
import java .util .concurrent .ThreadFactory ;
9
9
10
10
public class ConnectionParams {
11
- private final String username ;
12
- private final String password ;
13
- private final ExecutorService executor ;
14
- private final String virtualHost ;
15
- private final Map <String , Object > clientProperties ;
16
- private final int requestedFrameMax ;
17
- private final int requestedChannelMax ;
18
- private final int requestedHeartbeat ;
11
+ private String username ;
12
+ private String password ;
13
+ private ExecutorService consumerWorkServiceExecutor ;
14
+ private ExecutorService shutdownExecutor ;
15
+ private String virtualHost ;
16
+ private Map <String , Object > clientProperties ;
17
+ private int requestedFrameMax ;
18
+ private int requestedChannelMax ;
19
+ private int requestedHeartbeat ;
19
20
private int handshakeTimeout ;
20
- private final int shutdownTimeout ;
21
- private final SaslConfig saslConfig ;
22
- private final long networkRecoveryInterval ;
23
- private final boolean topologyRecovery ;
24
-
25
- private final ExceptionHandler exceptionHandler ;
26
- private final ThreadFactory threadFactory ;
27
-
28
- /**
29
- * @param username name used to establish connection
30
- * @param password for <code><b>username</b></code>
31
- * @param executor thread pool service for consumer threads for channels on this connection
32
- * @param virtualHost virtual host of this connection
33
- * @param clientProperties client info used in negotiating with the server
34
- * @param requestedFrameMax max size of frame offered
35
- * @param requestedChannelMax max number of channels offered
36
- * @param requestedHeartbeat heart-beat in seconds offered
37
- * @param saslConfig sasl configuration hook
38
- * @param networkRecoveryInterval interval used when recovering from network failure
39
- * @param topologyRecovery should topology (queues, exchanges, bindings, consumers) recovery be performed?
40
- * @param threadFactory factory that instantiates threads used by the client
41
- * @param exceptionHandler handles unhandled consumer exceptions
42
- */
43
- public ConnectionParams (String username , String password , ExecutorService executor ,
44
- String virtualHost , Map <String , Object > clientProperties ,
45
- int requestedFrameMax , int requestedChannelMax , int requestedHeartbeat ,
46
- int shutdownTimeout , SaslConfig saslConfig , long networkRecoveryInterval ,
47
- boolean topologyRecovery , ExceptionHandler exceptionHandler , ThreadFactory threadFactory ) {
48
- this .username = username ;
49
- this .password = password ;
50
- this .executor = executor ;
51
- this .virtualHost = virtualHost ;
52
- this .clientProperties = clientProperties ;
53
- this .requestedFrameMax = requestedFrameMax ;
54
- this .requestedChannelMax = requestedChannelMax ;
55
- this .requestedHeartbeat = requestedHeartbeat ;
56
- this .shutdownTimeout = shutdownTimeout ;
57
- this .saslConfig = saslConfig ;
58
- this .networkRecoveryInterval = networkRecoveryInterval ;
59
- this .topologyRecovery = topologyRecovery ;
60
- this .exceptionHandler = exceptionHandler ;
61
- this .threadFactory = threadFactory ;
62
- }
21
+ private int shutdownTimeout ;
22
+ private SaslConfig saslConfig ;
23
+ private long networkRecoveryInterval ;
24
+ private boolean topologyRecovery ;
25
+
26
+ private ExceptionHandler exceptionHandler ;
27
+ private ThreadFactory threadFactory ;
28
+
29
+ public ConnectionParams () {}
63
30
64
31
public String getUsername () {
65
32
return username ;
@@ -69,8 +36,8 @@ public String getPassword() {
69
36
return password ;
70
37
}
71
38
72
- public ExecutorService getExecutor () {
73
- return executor ;
39
+ public ExecutorService getConsumerWorkServiceExecutor () {
40
+ return consumerWorkServiceExecutor ;
74
41
}
75
42
76
43
public String getVirtualHost () {
@@ -121,7 +88,71 @@ public boolean isTopologyRecoveryEnabled() {
121
88
return topologyRecovery ;
122
89
}
123
90
124
- public ThreadFactory getThreadFactory () {
91
+ public ThreadFactory getThreadFactory () {
125
92
return threadFactory ;
126
93
}
94
+
95
+ public void setUsername (String username ) {
96
+ this .username = username ;
97
+ }
98
+
99
+ public void setPassword (String password ) {
100
+ this .password = password ;
101
+ }
102
+
103
+ public void setConsumerWorkServiceExecutor (ExecutorService consumerWorkServiceExecutor ) {
104
+ this .consumerWorkServiceExecutor = consumerWorkServiceExecutor ;
105
+ }
106
+
107
+ public void setVirtualHost (String virtualHost ) {
108
+ this .virtualHost = virtualHost ;
109
+ }
110
+
111
+ public void setClientProperties (Map <String , Object > clientProperties ) {
112
+ this .clientProperties = clientProperties ;
113
+ }
114
+
115
+ public void setRequestedFrameMax (int requestedFrameMax ) {
116
+ this .requestedFrameMax = requestedFrameMax ;
117
+ }
118
+
119
+ public void setRequestedChannelMax (int requestedChannelMax ) {
120
+ this .requestedChannelMax = requestedChannelMax ;
121
+ }
122
+
123
+ public void setRequestedHeartbeat (int requestedHeartbeat ) {
124
+ this .requestedHeartbeat = requestedHeartbeat ;
125
+ }
126
+
127
+ public void setShutdownTimeout (int shutdownTimeout ) {
128
+ this .shutdownTimeout = shutdownTimeout ;
129
+ }
130
+
131
+ public void setSaslConfig (SaslConfig saslConfig ) {
132
+ this .saslConfig = saslConfig ;
133
+ }
134
+
135
+ public void setNetworkRecoveryInterval (long networkRecoveryInterval ) {
136
+ this .networkRecoveryInterval = networkRecoveryInterval ;
137
+ }
138
+
139
+ public void setTopologyRecovery (boolean topologyRecovery ) {
140
+ this .topologyRecovery = topologyRecovery ;
141
+ }
142
+
143
+ public void setExceptionHandler (ExceptionHandler exceptionHandler ) {
144
+ this .exceptionHandler = exceptionHandler ;
145
+ }
146
+
147
+ public void setThreadFactory (ThreadFactory threadFactory ) {
148
+ this .threadFactory = threadFactory ;
149
+ }
150
+
151
+ public ExecutorService getShutdownExecutor () {
152
+ return shutdownExecutor ;
153
+ }
154
+
155
+ public void setShutdownExecutor (ExecutorService shutdownExecutor ) {
156
+ this .shutdownExecutor = shutdownExecutor ;
157
+ }
127
158
}
0 commit comments