Skip to content

Document "send and receive" methods return value after a timeout #1410

Closed
@bastiat

Description

@bastiat

Enhancement

Regarding javadoc of eg convertSendAndReceiveAsType(...)

Returns:
the response if there is one. [I suggest adding: null on timeout]
Throws:
AmqpException - if there is a problem.

As for me documentation doesn't state it clearly that on timeout null is returned.
It's inconsistent with Future.get(long timeout, TimeUnit unit)

		RabbitTemplate: 
		@Nullable
		public Message get(long timeout, TimeUnit unit) throws InterruptedException {
			try {
				return this.future.get(timeout, unit);
			}
			catch (ExecutionException e) {
				throw RabbitExceptionTranslator.convertRabbitAccessException(e.getCause()); // NOSONAR lost stack trace
			}
			catch (TimeoutException e) {
				return null;
			}
		}

What was the design decision behind it?
Why is returning null considered better than throwing TimeoutException?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions