File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
src/main/java/com/rabbitmq/stream/impl Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -136,17 +136,24 @@ public ProducerBuilder routing(
136136 Function <Message , String > routingKeyExtractor ,
137137 RoutingType routingType ,
138138 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 ) {
144140 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 ;
146147 }
147148 return this ;
148149 }
149150
151+ void resetRouting () {
152+ this .routingKeyExtractor = null ;
153+ this .routingType = null ;
154+ this .hash = null ;
155+ }
156+
150157 public Producer build () {
151158 if (subEntrySize == 1 && compression != null ) {
152159 throw new IllegalArgumentException (
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class SuperStreamProducer implements Producer {
4444 this .superStream = superStream ;
4545 this .producerBuilder = producerBuilder .duplicate ();
4646 this .producerBuilder .stream (null );
47- this .producerBuilder .routing ( null , null );
47+ this .producerBuilder .resetRouting ( );
4848 }
4949
5050 @ Override
You can’t perform that action at this time.
0 commit comments