-
Notifications
You must be signed in to change notification settings - Fork 55
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
Adapt behavior for non-recoverable connections/channels #143
Comments
There is one more item that needs checking. Every "send" operation in the Sender is concluded by closing the channel by default (default implementation of the channelCloseHandler). .doFinally(st -> channelCloseHandler.accept(st, channel)) It's not clear how that is supposed to interact with Mono, etc. |
One more item I noticed is that default SendOptions uses exceptionHandler with ExceptionHandlers.CONNECTION_RECOVERY_PREDICATE. This also creates some "effects" when using retry with connections. |
The channel is closed when the flux terminates, so indeed on each |
What do you suggest to do? I don't think we can disable retry by default if the channel is not recoverable, it could break existing code (it's unlikely, but still). Do you still retry when using non-recoverable connections? If so, I guess you provide your own exception handler (that's what options are for). If not, again, you provide your own exception handler, using the options in the way they're meant for. I don't see any default behavior that would fit recoverable and non-recoverable resources at the same time in this case. If you have suggestions, I'm open to the introduction of ready-to-use utilities that would fit most non-recoverable resources use cases though. |
I am not quite sure what the best API would be. For example when using sender.send with a Flux of messages it's hard to get the success/failure confirmation for each specific message. Send returns then(), the only way to get the rabbit error is to install the exception handler, it's hard to get the positive confirmation that the message was sent, so in most cases I see. code using sender.send(Mono.just(message)) that allows to subscribe to ok and error condition. May be a better way would be to return a publisher of results from send that would have OK or Exception for each incoming message. |
you mean something like sendWithPublishConfirm but the returned flux would just tell whether the |
Probably yes. In addition to that Mono Void ( then() ) that is currently returned is "hard" to work with in Reactor. |
My mistake, it would be a breaking change, so it'll have to go in 2.0. |
I created a follow-up issue #146 , don't hesitate to post some ideas about what the return flux should contain. |
Following up on #142.
The code assumes that connections and channels are recoverable in several places, this does not play well if the connections (and the channels) are not.
reactor-rabbitmq/src/main/java/reactor/rabbitmq/Receiver.java
Lines 159 to 165 in fcb27c9
The complete signal should always be generated, because a non-recoverable channel would not recover by itself.
reactor-rabbitmq/src/main/java/reactor/rabbitmq/Receiver.java
Line 83 in fcb27c9
The
connectionMono
should not be cached because again a non-recoverable connection will not recover, a new instance must be provided by theconnectionMono
. This would allow to use theconnectionMonoConfigurator
to provide some retry logic instead of provided a fullconnectionMono
.There may be other places where checking the connection/channel are recoverable or not may be appropriate.
The text was updated successfully, but these errors were encountered: