Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Sender does not close / manager resource management channel when declaring objects #183

@a701440

Description

@a701440

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions