15
15
import static org .eclipse .ditto .base .model .common .ConditionChecker .checkNotNull ;
16
16
17
17
import java .time .Instant ;
18
+ import java .util .List ;
18
19
import java .util .Objects ;
19
20
import java .util .Optional ;
20
21
import java .util .Set ;
21
22
22
23
import javax .annotation .Nullable ;
23
24
25
+ import org .apache .pekko .stream .KillSwitch ;
26
+ import org .apache .pekko .stream .javadsl .SourceQueueWithComplete ;
24
27
import org .eclipse .ditto .base .model .acks .AcknowledgementLabel ;
25
28
import org .eclipse .ditto .base .model .auth .AuthorizationContext ;
26
29
import org .eclipse .ditto .base .model .json .JsonSchemaVersion ;
27
30
import org .eclipse .ditto .gateway .service .streaming .actors .SessionedJsonifiable ;
28
31
29
- import org .apache .pekko .stream .KillSwitch ;
30
- import org .apache .pekko .stream .javadsl .SourceQueueWithComplete ;
31
-
32
32
/**
33
33
* Message to be sent in order to establish a new "streaming" connection via {@link org.eclipse.ditto.gateway.service.streaming.actors.StreamingActor}.
34
34
*/
@@ -41,6 +41,7 @@ public final class Connect {
41
41
@ Nullable private final Instant sessionExpirationTime ;
42
42
private final Set <AcknowledgementLabel > declaredAcknowledgementLabels ;
43
43
private final AuthorizationContext connectionAuthContext ;
44
+ private final List <String > namespaces ;
44
45
@ Nullable private final KillSwitch killSwitch ;
45
46
46
47
/**
@@ -53,6 +54,7 @@ public final class Connect {
53
54
* @param sessionExpirationTime how long to keep the session alive when idling.
54
55
* @param declaredAcknowledgementLabels labels of acknowledgements this session may send.
55
56
* @param connectionAuthContext the authorizationContext of the streaming session.
57
+ * @param namespaces the namespaces to subscribe to in the streaming session (if already known).
56
58
* @param killSwitch the kill switch to terminate the streaming session.
57
59
*/
58
60
public Connect (final SourceQueueWithComplete <SessionedJsonifiable > eventAndResponsePublisher ,
@@ -62,6 +64,7 @@ public Connect(final SourceQueueWithComplete<SessionedJsonifiable> eventAndRespo
62
64
@ Nullable final Instant sessionExpirationTime ,
63
65
final Set <AcknowledgementLabel > declaredAcknowledgementLabels ,
64
66
final AuthorizationContext connectionAuthContext ,
67
+ final List <String > namespaces ,
65
68
@ Nullable final KillSwitch killSwitch ) {
66
69
this .eventAndResponsePublisher = eventAndResponsePublisher ;
67
70
this .connectionCorrelationId = checkNotNull (connectionCorrelationId , "connectionCorrelationId" )
@@ -71,6 +74,7 @@ public Connect(final SourceQueueWithComplete<SessionedJsonifiable> eventAndRespo
71
74
this .sessionExpirationTime = sessionExpirationTime ;
72
75
this .declaredAcknowledgementLabels = declaredAcknowledgementLabels ;
73
76
this .connectionAuthContext = connectionAuthContext ;
77
+ this .namespaces = namespaces ;
74
78
this .killSwitch = killSwitch ;
75
79
}
76
80
@@ -102,6 +106,10 @@ public AuthorizationContext getConnectionAuthContext() {
102
106
return connectionAuthContext ;
103
107
}
104
108
109
+ public List <String > getNamespaces () {
110
+ return namespaces ;
111
+ }
112
+
105
113
public Optional <KillSwitch > getKillSwitch () {
106
114
return Optional .ofNullable (killSwitch );
107
115
}
@@ -121,13 +129,14 @@ public boolean equals(final Object o) {
121
129
Objects .equals (sessionExpirationTime , connect .sessionExpirationTime ) &&
122
130
Objects .equals (declaredAcknowledgementLabels , connect .declaredAcknowledgementLabels ) &&
123
131
Objects .equals (connectionAuthContext , connect .connectionAuthContext ) &&
132
+ Objects .equals (namespaces , connect .namespaces ) &&
124
133
Objects .equals (killSwitch , connect .killSwitch );
125
134
}
126
135
127
136
@ Override
128
137
public int hashCode () {
129
138
return Objects .hash (eventAndResponsePublisher , connectionCorrelationId , type , sessionExpirationTime ,
130
- declaredAcknowledgementLabels , connectionAuthContext , killSwitch );
139
+ declaredAcknowledgementLabels , connectionAuthContext , namespaces , killSwitch );
131
140
}
132
141
133
142
@ Override
@@ -139,6 +148,7 @@ public String toString() {
139
148
", sessionExpirationTime=" + sessionExpirationTime +
140
149
", declaredAcknowledgementLabels=" + declaredAcknowledgementLabels +
141
150
", connectionAuthContext=" + connectionAuthContext +
151
+ ", namespaces=" + namespaces +
142
152
", killSwitch=" + killSwitch +
143
153
"]" ;
144
154
}
0 commit comments