Skip to content

createChannel should throw an exception if channel is not available #430

Closed
@ralfstx

Description

@ralfstx

The method Connection::createChannel returns null under certain circumstances. This is correctly stated by the method's contract even though the circumstances that can lead to "no channel available" are not further described there. It seems that this happens when some maximum count is exceeded.

I believe that returning null is unexpected by most users of this API. It was for me and lead to an NPE. Since the method declares an IOException I would expect that an IOException is also thrown when the acquisition of a new channel fails for whatever reason. Not throwing an exception provokes client code that doesn't handle this case.

RabbitMQ Version: using the docker image rabbitmq:3-management.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions