File tree 2 files changed +14
-7
lines changed
src/main/java/com/rabbitmq/stream/impl
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -136,17 +136,24 @@ public ProducerBuilder routing(
136
136
Function <Message , String > routingKeyExtractor ,
137
137
RoutingType routingType ,
138
138
ToIntFunction <String > hash ) {
139
- if ((routingKeyExtractor == null && routingType == null )
140
- || (routingKeyExtractor != null && routingType != null )) {
141
- this .routingKeyExtractor = routingKeyExtractor ;
142
- this .routingType = routingType ;
143
- } else {
139
+ if (routingKeyExtractor == null || routingType == null ) {
144
140
throw new IllegalArgumentException (
145
- "both routing key extractor and routing type must be " + "non-null" );
141
+ "both routing key extractor and routing type must be non-null" );
142
+ }
143
+ this .routingKeyExtractor = routingKeyExtractor ;
144
+ this .routingType = routingType ;
145
+ if (hash != null ) {
146
+ this .hash = hash ;
146
147
}
147
148
return this ;
148
149
}
149
150
151
+ void resetRouting () {
152
+ this .routingKeyExtractor = null ;
153
+ this .routingType = null ;
154
+ this .hash = null ;
155
+ }
156
+
150
157
public Producer build () {
151
158
if (subEntrySize == 1 && compression != null ) {
152
159
throw new IllegalArgumentException (
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class SuperStreamProducer implements Producer {
44
44
this .superStream = superStream ;
45
45
this .producerBuilder = producerBuilder .duplicate ();
46
46
this .producerBuilder .stream (null );
47
- this .producerBuilder .routing ( null , null );
47
+ this .producerBuilder .resetRouting ( );
48
48
}
49
49
50
50
@ Override
You can’t perform that action at this time.
0 commit comments