-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Timeout added to WebFluxMessageHandlerSpec.java & WebFluxRequestExecutingMessageHandler.java #3188
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
Conversation
…tingMessageHandler.java spring-projects#3183
…-3183 # Conflicts: # src/reference/asciidoc/whats-new.adoc
…tingMessageHandler.java spring-projects#3183
Thanks, but see the last sentence in the CONTRIBUTION guideline:
Having so many contribution from you would benefit from a good commit message formatting. 😄 |
I will have a look at this and follow this. I have little time to contribute for this, so created a PR. Will look at your review comments tomorrow. Good Night. Hope we can agree on this Feature Enhancement. I am working on adding transform method as well as you suggested, I would prefer to raise a separate PR for transform. Also, I am thinking of right usecase for adding it in the test cases for the transform message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, consider to expose this new request-timeout
attribute in the XML configuration. See spring-integration-webflux.xsd
and respective WebFluxOutboundChannelAdapterParser
.
Then you can find a WebFluxOutboundChannelAdapterParserTests
to verify that new option is applied properly.
You can also add your name to all the affected classes.
Thank you!
@@ -144,6 +145,41 @@ public WebFluxMessageHandlerSpec publisherElementTypeExpression(Expression publi | |||
return this; | |||
} | |||
|
|||
/** | |||
* Specify the timeout value for receiving the response form the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: from
? And that has to be an "a timeout"
@@ -144,6 +145,41 @@ public WebFluxMessageHandlerSpec publisherElementTypeExpression(Expression publi | |||
return this; | |||
} | |||
|
|||
/** | |||
* Specify the timeout value for receiving the response form the server. | |||
* If the response is not received with in timeout value, will result in Timeout Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"within"
* @return the spec | ||
* @since 5.3 | ||
*/ | ||
public WebFluxMessageHandlerSpec timeout(long timeoutInMillis) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's bad name. There are many aspects in Spring Integration components and a lot of different timeout options.
Would be great to be more specific here. How about a requestTimeout
?
Also: I wouldn't expose this long
option. It is not too hard to have that Duration.ofMillis()
in the target application.
Plus with Spring Boot configuration properties we can provide an option in the duration style and we'll get exactly Duration
instance in the POJO
* @param timeout accepts {@link java.time.Duration} | ||
* @since 5.3 | ||
*/ | ||
public void setTimeout(Duration timeout) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this is simple one, but would be better to not have it since a Function
can simple cover the static value as well.
So, please, remove
* If the response is not received with in timeout value, will result in Timeout Exception | ||
* @since 5.3 | ||
*/ | ||
public void setTimeoutFunction(Function<Message<?>, Duration> timeoutFunction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we prefer an Expression
variant instead of function. This way a timeout could be configured in the XML an easy way.
There is a FunctionExpression
to cover this case. And exactly Java DSL should expose a function-based option. Of course, alongside with an expression. See publisherElementTypeFunction
in the modified by you WebFluxMessageHandlerSpec
|
||
Message<String> testMessage = | ||
MessageBuilder.withPayload("test") | ||
.setReplyChannel(replyChannel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't use a setReplyChannel
for this kind of test. Since you use the same instance for both reply and error responses, I was confused first about exception assertion in the end. I was expected from "error channel", but I saw a replyChannel
. So, your test-case mislead me to investigate how do we process exceptions like that timeout 😢
=== WebFlux Changes | ||
|
||
The `timeoutFunction` property is added to `WebFluxRequestExecutingMessageHandler`. | ||
Java DSL accessor which accepts long Timeout, Duration Timeout & Timeout Function is provided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The good sentence ends with period.
I don't think that word "timeout" deserves to be capitalized.
I would even say if your don't talk about code, then even function
word doesn't deserve to be capitalized.
Would be great to have here a brief description for the reason of this new option. See something already existed in this doc.
Then we definitely need a link to the target docs.
And what is very important we need a description in the final docs - webflux.adoc
.
I don't see changes and your comment in the PR, but if you talk about |
Hi @artembilan , I was busy with office activities, I am almost done with my changes. I will push changes today |
you know after watching yesterday Josh Long's Reactive Revolution presentation I have to take my decision back. There are indeed much more control and aspect operators in the Reactor So, for me it sounds more like a general solution for any So, starting from here it is 👎 from me for this PR: a general solution with a |
Hi @artembilan, |
Closed in favor of #3197 @sirimamilla , you are feel free to provide any feedback over there. Thank you for your contribution! |
Timeout added to WebFluxMessageHandlerSpec.java & WebFluxRequestExecutingMessageHandler.java #3183
Repushed from GH-3183