Comments (3)
The channel to deal with resources is used during the life of the Sender
instance. You can provide your own channel mono in the SenderOptions
. You can also provide a dedicated instance with the ResourceManagementOptions
parameter of each resource-related method.
If you hit concurrency issues with resource management, you can provide your own instance of scheduler with the SenderOptions#resourceManagementScheduler
.
from reactor-rabbitmq.
I understand that. It's just the patterns used with the primary channelMono and ResourceManagement channelMono are different in the Sender class. Primary channelMono supports ChannelPool and returns channels to the pool using the close handler of the pool. Resource management channel mono does not support that and it would be nice if this was consistent, especially given that channels are not thread-safe.
I actually ended-up creating a work-around hack to return the channels used in resource management Mono to the channel
pool using Reactor subscribe context and doFinally operator (getAutoReturnedChannelMono):
public Mono<? extends Channel> getAutoReturnedChannelMono() {
return getChannelMono().transformDeferredContextual(this::autoReturnChannel).contextWrite(this::createAutoReturnContext);
}
private Mono<? extends Channel> autoReturnChannel(Mono<? extends Channel> channelMono, ContextView context) {
AtomicReference<Channel> ref = context.get(AtomicReference.class);
return channelMono.doOnNext(ref::set).doFinally(signal -> getChannelCloseHandler().accept(signal, ref.get()));
}
private Context createAutoReturnContext(Context context) {
return context.put(AtomicReference.class, new AtomicReference<Channel>());
}
...
Related to this LazyChannelPool class could also use some improvement.
When dispensing channels it does not check that channel belongs to the same connection that is currently in use, may be should also check if the channel is still open. Also when dispensing channels it would be nice to have a "loop" and drain "bad" channels from the pool, so that they can be garbage collected.
from reactor-rabbitmq.
Feel free to provide a PR with backward-compatible changes. There may be unfortunate choices in the current implementation but we have to stick with them until the next release that allows breaking changes (minor releases for Reactor projects IIRC).
from reactor-rabbitmq.
Related Issues (20)
- Bump dependencies (1.4.x) HOT 1
- Blocking call when "Sender::sendWithPublisherConfirms" HOT 2
- Bump dependencies HOT 1
- Emit publish nack when losing connection
- Emit publish nack when retry times out
- Consider adding an option to Sender.send to reuse the channel
- AcknowledgableDelivery.ack() blocks HOT 1
- Provide a way to specify Consumer Arguments in Receiver.consume* methods HOT 3
- Bump dependencies HOT 1
- Bump dependencies HOT 1
- Bump Gradle to 7.2
- Pulsar and RabbitMQ integration HOT 3
- RPCs are executed one at a time, blocking on a mutex HOT 2
- receiver.consumeManualAck does not seem compatible with take(int) reactor operator
- Unclear how to keep the consumer open after an exception is thrown
- Receiver does not recover or catch the exception when there is a rabbitmq delivery acknowledgement timeout HOT 3
- Release to repo.spring.io is failing HOT 1
- Reuse channel in receiver to allow setup global qos
- Upgrade RabbitMQ client to support Micrometer Observation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactor-rabbitmq.