Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMQP-503: Add Blocking Receive to RabbitTemplate #297

Closed
wants to merge 2 commits into from

Conversation

garyrussell
Copy link
Contributor

JIRA: https://jira.spring.io/browse/AMQP-503

Now that the QueueingConsumer is no longer deprecated, add
receiveTimeout to the RabbitTemplate to allow for blocking receive operations.

JIRA: https://jira.spring.io/browse/AMQP-503

Now that the `QueueingConsumer` is no longer deprecated, add
`receiveTimeout` to the `RabbitTemplate` to allow for blocking `receive` operations.
}

/**
* Non-blocking receive with timeout.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without

@garyrussell
Copy link
Contributor Author

Pushed

else {
delivery = consumer.nextDelivery(receiveTimeout);
}
channel.basicCancel(consumer.getConsumerTag());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basicCancel to prevent the consumption for the next message ?

From other side can't we use shared QueueingConsumer instance since this operation is blocked?
Or at least lazy-load (TTL removal) per queueName, but blocked anyway...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, cancel with prefetch = 1 means we'll only fetch 1 message.

I thought about a permanent QC, maybe just for the configured (default) queue (bear in mind people can consume from arbitrary queues), but then we need logic to deal with canceled consumers, etc, etc.

I figured we can keep it simple for now and enhance later if the demand arises.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@artembilan
Why should we set receive timeout globally? Of course, it is handy to have default receiveTimeout, but it would be useful to have method receive(String queueName, long timeout, TimeUnit unit) (or receive(queueName, timeoutMillis)), isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to open a new feature request.

@artembilan
Copy link
Member

So, merging as is after rebase

@artembilan
Copy link
Member

Merged as c1d0cad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants