Sender class uses separate resource management channel mono that supplies a channel for declaration operations.
However unlike the "send" operation declaration operations do not close/handle closing of the channel.
This promotes giving the same cached channel for all resource management operations.
However it seems like channels can not be used by multiple threads concurrently, so that does not work well.
See: rabbitmq/rabbitmq-java-client#1194
return channelMono.map(channel -> {
try {
return channel.asyncCompletableRpc(declare);
} catch (IOException e) {
throw new RabbitFluxException("Error during RPC call", e);
}
}).flatMap(future -> Mono.fromCompletionStage(future))
.flatMap(command -> Mono.just((AMQP.Queue.DeclareOk) command.getMethod()))
.publishOn(resourceManagementScheduler);
This will request new channel from the channelMono and then not close it and also not give it to some close-handler.
In send operations we have:
.doFinally(st -> channelCloseHandler.accept(st, channel))