{"action":"created","comment":{"url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/comments/127327329","pull_request_review_id":49900940,"id":127327329,"diff_hunk":"@@ -533,6 +546,135 @@ private Object doSendAndReceive(Object object, boolean shouldConvert) {\n \t\treturn reply;\n \t}\n \n+\tprotected Mono<Message<?>> sendAndReceiveMessageReactive(Object object) {\n+\t\tinitializeIfNecessary();\n+\t\tAssert.notNull(object, \"request must not be null\");\n+\t\tMessageChannel requestChannel = getRequestChannel();\n+\t\tif (requestChannel == null) {\n+\t\t\tthrow new MessagingException(\"No request channel available. Cannot send request message.\");\n+\t\t}\n+\n+\t\tregisterReplyMessageCorrelatorIfNecessary();\n+\n+\t\treturn doSendAndReceiveMessageReactive(requestChannel, object, false);\n+\t}\n+\n+\t@SuppressWarnings(\"unchecked\")\n+\tprivate Mono<Message<?>> doSendAndReceiveMessageReactive(MessageChannel requestChannel, Object object,\n+\t\t\tboolean error) {\n+\n+\t\tAtomicReference<Message<?>> requestMessageReference = new AtomicReference<>();\n+\n+\t\treturn Mono\n+\t\t\t\t.<Message<?>>defer(() -> {\n+\t\t\t\t\tMessage<?> requestMessage;\n+\t\t\t\t\ttry {\n+\t\t\t\t\t\trequestMessage = object instanceof Message<?>\n+\t\t\t\t\t\t\t\t? (Message<?>) object\n+\t\t\t\t\t\t\t\t: this.requestMapper.toMessage(object);\n+\n+\t\t\t\t\t\trequestMessage = this.historyWritingPostProcessor.postProcessMessage(requestMessage);\n+\n+\t\t\t\t\t}\n+\t\t\t\t\tcatch (Exception e) {\n+\t\t\t\t\t\tthrow new MessageMappingException(\"Cannot map to message: \" + object, e);\n+\t\t\t\t\t}\n+\n+\t\t\t\t\tObject originalReplyChannelHeader = requestMessage.getHeaders().getReplyChannel();\n+\t\t\t\t\tObject originalErrorChannelHeader = requestMessage.getHeaders().getErrorChannel();\n+\n+\t\t\t\t\tFutureReplyChannel replyChannel = new FutureReplyChannel();\n+\n+\t\t\t\t\trequestMessage = MutableMessageBuilder.fromMessage(requestMessage)\n+\t\t\t\t\t\t\t.setReplyChannel(replyChannel)\n+\t\t\t\t\t\t\t.setHeader(this.messagingTemplate.getSendTimeoutHeader(), null)\n+\t\t\t\t\t\t\t.setHeader(this.messagingTemplate.getReceiveTimeoutHeader(), null)\n+\t\t\t\t\t\t\t.setErrorChannel(replyChannel)\n+\t\t\t\t\t\t\t.build();\n+\n+\t\t\t\t\trequestMessageReference.set(requestMessage);\n+\n+\t\t\t\t\tif (requestChannel instanceof ReactiveStreamsSubscribableChannel) {\n+\t\t\t\t\t\t((ReactiveStreamsSubscribableChannel) requestChannel)\n+\t\t\t\t\t\t\t\t.subscribeTo(Mono.just(requestMessage));\n+\t\t\t\t\t}\n+\t\t\t\t\telse {\n+\t\t\t\t\t\tlong sendTimeout = sendTimeout(requestMessage);\n+\n+\t\t\t\t\t\tboolean sent =\n+\t\t\t\t\t\t\t\tsendTimeout >= 0\n+\t\t\t\t\t\t\t\t\t\t? requestChannel.send(requestMessage, sendTimeout)\n+\t\t\t\t\t\t\t\t\t\t: requestChannel.send(requestMessage);\n+\n+\t\t\t\t\t\tif (!sent) {\n+\t\t\t\t\t\t\tthrow new MessageDeliveryException(requestMessage,\n+\t\t\t\t\t\t\t\t\t\"Failed to send message to channel '\" + requestChannel +\n+\t\t\t\t\t\t\t\t\t\t\t\"' within timeout: \" + sendTimeout);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t}\n+\n+\t\t\t\t\treturn Mono.fromFuture(replyChannel.messageFuture)\n+\t\t\t\t\t\t\t.map(replyMessage ->\n+\t\t\t\t\t\t\t\t\tMessageBuilder.fromMessage(replyMessage)\n+\t\t\t\t\t\t\t\t\t\t\t.setHeader(MessageHeaders.REPLY_CHANNEL, originalReplyChannelHeader)\n+\t\t\t\t\t\t\t\t\t\t\t.setHeader(MessageHeaders.ERROR_CHANNEL, originalErrorChannelHeader)\n+\t\t\t\t\t\t\t\t\t\t\t.build());\n+\t\t\t\t})\n+\t\t\t\t.doOnSubscribe(s -> {\n+\t\t\t\t\tif (!error && this.countsEnabled) {\n+\t\t\t\t\t\tthis.messageCount.incrementAndGet();\n+\t\t\t\t\t}\n+\t\t\t\t})\n+\t\t\t\t.onErrorResume(t -> handleSendError(requestMessageReference.get(), t));","path":"spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java","position":147,"original_position":147,"commit_id":"d46e951e9804ddf9f2f9073af9d1a7bc17621ed9","original_commit_id":"d46e951e9804ddf9f2f9073af9d1a7bc17621ed9","user":{"login":"smaldini","id":76718,"avatar_url":"https://avatars1.githubusercontent.com/u/76718?v=3","gravatar_id":"","url":"https://api.github.com/users/smaldini","html_url":"https://github.com/smaldini","followers_url":"https://api.github.com/users/smaldini/followers","following_url":"https://api.github.com/users/smaldini/following{/other_user}","gists_url":"https://api.github.com/users/smaldini/gists{/gist_id}","starred_url":"https://api.github.com/users/smaldini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaldini/subscriptions","organizations_url":"https://api.github.com/users/smaldini/orgs","repos_url":"https://api.github.com/users/smaldini/repos","events_url":"https://api.github.com/users/smaldini/events{/privacy}","received_events_url":"https://api.github.com/users/smaldini/received_events","type":"User","site_admin":false},"body":"if moved inside defer, can directly use message created in it.","created_at":"2017-07-13T20:50:24Z","updated_at":"2017-07-13T20:52:18Z","html_url":"https://github.com/spring-projects/spring-integration/pull/2198#discussion_r127327329","pull_request_url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198","_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/comments/127327329"},"html":{"href":"https://github.com/spring-projects/spring-integration/pull/2198#discussion_r127327329"},"pull_request":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198"}}},"pull_request":{"url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198","id":128473363,"html_url":"https://github.com/spring-projects/spring-integration/pull/2198","diff_url":"https://github.com/spring-projects/spring-integration/pull/2198.diff","patch_url":"https://github.com/spring-projects/spring-integration/pull/2198.patch","issue_url":"https://api.github.com/repos/spring-projects/spring-integration/issues/2198","number":2198,"state":"open","locked":false,"title":"INT-4300: Add WebFlux server support","user":{"login":"artembilan","id":1071590,"avatar_url":"https://avatars0.githubusercontent.com/u/1071590?v=3","gravatar_id":"","url":"https://api.github.com/users/artembilan","html_url":"https://github.com/artembilan","followers_url":"https://api.github.com/users/artembilan/followers","following_url":"https://api.github.com/users/artembilan/following{/other_user}","gists_url":"https://api.github.com/users/artembilan/gists{/gist_id}","starred_url":"https://api.github.com/users/artembilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artembilan/subscriptions","organizations_url":"https://api.github.com/users/artembilan/orgs","repos_url":"https://api.github.com/users/artembilan/repos","events_url":"https://api.github.com/users/artembilan/events{/privacy}","received_events_url":"https://api.github.com/users/artembilan/received_events","type":"User","site_admin":false},"body":"JIRA: https://jira.spring.io/browse/INT-4300\r\n\r\n* Add `ReactiveHttpInboundEndpoint` based on the WebFlux foundation\r\n* Extract `BaseHttpInboundEndpoint` for common\r\nHTTP Inbound Channel Adapters options\r\n* Make `spring-webmvc` and `spring-webflux` as `optional` dependencies\r\nto let end-user to choose\r\n* Refactor `HttpContextUtils` to include constants\r\nfor newly added WebFlux support\r\n* Introduce `BaseHttpInboundEndpoint.setRequestPayloadTypeClass()`\r\nfor raw `Class<?>` and modify existing `setRequestPayloadType()`\r\nfor the `ResolvableType`\r\n* Refactor existing MVC tests and XML components parsers to use\r\nnew `setRequestPayloadTypeClass()`\r\n* Add `MessagingGatewaySupport.sendAndReceiveMessageReactive()` to get\r\na reply from downstream flow reactive back-pressure manner\r\n* Add `IntegrationHandlerResultHandler` implementation to let WebFlux\r\ninfrastructure to handle the `Mono<Void>` from the `ReactiveHttpInboundEndpoint`\r\nproperly\r\n* Fix `JdbcLockRegistryLeaderInitiatorTests` race condition to assert\r\nthe `initiator1` is elected eventually after yielding when the `initiator2`\r\nis stopped","created_at":"2017-07-01T02:09:54Z","updated_at":"2017-07-13T20:52:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2409ee8a4aa45ca0148fc4760fb0088d9f0f2f6a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198/commits","review_comments_url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198/comments","review_comment_url":"https://api.github.com/repos/spring-projects/spring-integration/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spring-projects/spring-integration/issues/2198/comments","statuses_url":"https://api.github.com/repos/spring-projects/spring-integration/statuses/d46e951e9804ddf9f2f9073af9d1a7bc17621ed9","head":{"label":"artembilan:INT-4300","ref":"INT-4300","sha":"d46e951e9804ddf9f2f9073af9d1a7bc17621ed9","user":{"login":"artembilan","id":1071590,"avatar_url":"https://avatars0.githubusercontent.com/u/1071590?v=3","gravatar_id":"","url":"https://api.github.com/users/artembilan","html_url":"https://github.com/artembilan","followers_url":"https://api.github.com/users/artembilan/followers","following_url":"https://api.github.com/users/artembilan/following{/other_user}","gists_url":"https://api.github.com/users/artembilan/gists{/gist_id}","starred_url":"https://api.github.com/users/artembilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artembilan/subscriptions","organizations_url":"https://api.github.com/users/artembilan/orgs","repos_url":"https://api.github.com/users/artembilan/repos","events_url":"https://api.github.com/users/artembilan/events{/privacy}","received_events_url":"https://api.github.com/users/artembilan/received_events","type":"User","site_admin":false},"repo":{"id":2686240,"name":"spring-integration","full_name":"artembilan/spring-integration","owner":{"login":"artembilan","id":1071590,"avatar_url":"https://avatars0.githubusercontent.com/u/1071590?v=3","gravatar_id":"","url":"https://api.github.com/users/artembilan","html_url":"https://github.com/artembilan","followers_url":"https://api.github.com/users/artembilan/followers","following_url":"https://api.github.com/users/artembilan/following{/other_user}","gists_url":"https://api.github.com/users/artembilan/gists{/gist_id}","starred_url":"https://api.github.com/users/artembilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artembilan/subscriptions","organizations_url":"https://api.github.com/users/artembilan/orgs","repos_url":"https://api.github.com/users/artembilan/repos","events_url":"https://api.github.com/users/artembilan/events{/privacy}","received_events_url":"https://api.github.com/users/artembilan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/artembilan/spring-integration","description":null,"fork":true,"url":"https://api.github.com/repos/artembilan/spring-integration","forks_url":"https://api.github.com/repos/artembilan/spring-integration/forks","keys_url":"https://api.github.com/repos/artembilan/spring-integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artembilan/spring-integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artembilan/spring-integration/teams","hooks_url":"https://api.github.com/repos/artembilan/spring-integration/hooks","issue_events_url":"https://api.github.com/repos/artembilan/spring-integration/issues/events{/number}","events_url":"https://api.github.com/repos/artembilan/spring-integration/events","assignees_url":"https://api.github.com/repos/artembilan/spring-integration/assignees{/user}","branches_url":"https://api.github.com/repos/artembilan/spring-integration/branches{/branch}","tags_url":"https://api.github.com/repos/artembilan/spring-integration/tags","blobs_url":"https://api.github.com/repos/artembilan/spring-integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artembilan/spring-integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artembilan/spring-integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/artembilan/spring-integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artembilan/spring-integration/statuses/{sha}","languages_url":"https://api.github.com/repos/artembilan/spring-integration/languages","stargazers_url":"https://api.github.com/repos/artembilan/spring-integration/stargazers","contributors_url":"https://api.github.com/repos/artembilan/spring-integration/contributors","subscribers_url":"https://api.github.com/repos/artembilan/spring-integration/subscribers","subscription_url":"https://api.github.com/repos/artembilan/spring-integration/subscription","commits_url":"https://api.github.com/repos/artembilan/spring-integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/artembilan/spring-integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/artembilan/spring-integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/artembilan/spring-integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/artembilan/spring-integration/contents/{+path}","compare_url":"https://api.github.com/repos/artembilan/spring-integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artembilan/spring-integration/merges","archive_url":"https://api.github.com/repos/artembilan/spring-integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artembilan/spring-integration/downloads","issues_url":"https://api.github.com/repos/artembilan/spring-integration/issues{/number}","pulls_url":"https://api.github.com/repos/artembilan/spring-integration/pulls{/number}","milestones_url":"https://api.github.com/repos/artembilan/spring-integration/milestones{/number}","notifications_url":"https://api.github.com/repos/artembilan/spring-integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artembilan/spring-integration/labels{/name}","releases_url":"https://api.github.com/repos/artembilan/spring-integration/releases{/id}","deployments_url":"https://api.github.com/repos/artembilan/spring-integration/deployments","created_at":"2011-11-01T08:04:04Z","updated_at":"2017-04-01T02:04:46Z","pushed_at":"2017-07-13T20:17:30Z","git_url":"git://github.com/artembilan/spring-integration.git","ssh_url":"git@github.com:artembilan/spring-integration.git","clone_url":"https://github.com/artembilan/spring-integration.git","svn_url":"https://github.com/artembilan/spring-integration","homepage":"","size":44615,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"spring-projects:master","ref":"master","sha":"4663862ea6e2c7f017594ec18ebf7cdf307ae601","user":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars3.githubusercontent.com/u/317776?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"repo":{"id":2090979,"name":"spring-integration","full_name":"spring-projects/spring-integration","owner":{"login":"spring-projects","id":317776,"avatar_url":"https://avatars3.githubusercontent.com/u/317776?v=3","gravatar_id":"","url":"https://api.github.com/users/spring-projects","html_url":"https://github.com/spring-projects","followers_url":"https://api.github.com/users/spring-projects/followers","following_url":"https://api.github.com/users/spring-projects/following{/other_user}","gists_url":"https://api.github.com/users/spring-projects/gists{/gist_id}","starred_url":"https://api.github.com/users/spring-projects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spring-projects/subscriptions","organizations_url":"https://api.github.com/users/spring-projects/orgs","repos_url":"https://api.github.com/users/spring-projects/repos","events_url":"https://api.github.com/users/spring-projects/events{/privacy}","received_events_url":"https://api.github.com/users/spring-projects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spring-projects/spring-integration","description":"Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)","fork":false,"url":"https://api.github.com/repos/spring-projects/spring-integration","forks_url":"https://api.github.com/repos/spring-projects/spring-integration/forks","keys_url":"https://api.github.com/repos/spring-projects/spring-integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spring-projects/spring-integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spring-projects/spring-integration/teams","hooks_url":"https://api.github.com/repos/spring-projects/spring-integration/hooks","issue_events_url":"https://api.github.com/repos/spring-projects/spring-integration/issues/events{/number}","events_url":"https://api.github.com/repos/spring-projects/spring-integration/events","assignees_url":"https://api.github.com/repos/spring-projects/spring-integration/assignees{/user}","branches_url":"https://api.github.com/repos/spring-projects/spring-integration/branches{/branch}","tags_url":"https://api.github.com/repos/spring-projects/spring-integration/tags","blobs_url":"https://api.github.com/repos/spring-projects/spring-integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spring-projects/spring-integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spring-projects/spring-integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/spring-projects/spring-integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spring-projects/spring-integration/statuses/{sha}","languages_url":"https://api.github.com/repos/spring-projects/spring-integration/languages","stargazers_url":"https://api.github.com/repos/spring-projects/spring-integration/stargazers","contributors_url":"https://api.github.com/repos/spring-projects/spring-integration/contributors","subscribers_url":"https://api.github.com/repos/spring-projects/spring-integration/subscribers","subscription_url":"https://api.github.com/repos/spring-projects/spring-integration/subscription","commits_url":"https://api.github.com/repos/spring-projects/spring-integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/spring-projects/spring-integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/spring-projects/spring-integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/spring-projects/spring-integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/spring-projects/spring-integration/contents/{+path}","compare_url":"https://api.github.com/repos/spring-projects/spring-integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spring-projects/spring-integration/merges","archive_url":"https://api.github.com/repos/spring-projects/spring-integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spring-projects/spring-integration/downloads","issues_url":"https://api.github.com/repos/spring-projects/spring-integration/issues{/number}","pulls_url":"https://api.github.com/repos/spring-projects/spring-integration/pulls{/number}","milestones_url":"https://api.github.com/repos/spring-projects/spring-integration/milestones{/number}","notifications_url":"https://api.github.com/repos/spring-projects/spring-integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spring-projects/spring-integration/labels{/name}","releases_url":"https://api.github.com/repos/spring-projects/spring-integration/releases{/id}","deployments_url":"https://api.github.com/repos/spring-projects/spring-integration/deployments","created_at":"2011-07-22T21:47:27Z","updated_at":"2017-07-13T15:20:40Z","pushed_at":"2017-07-13T20:17:32Z","git_url":"git://github.com/spring-projects/spring-integration.git","ssh_url":"git@github.com:spring-projects/spring-integration.git","clone_url":"https://github.com/spring-projects/spring-integration.git","svn_url":"https://github.com/spring-projects/spring-integration","homepage":"http://projects.spring.io/spring-integration/","size":44381,"stargazers_count":622,"watchers_count":622,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":534,"mirror_url":null,"open_issues_count":8,"forks":534,"open_issues":8,"watchers":622,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198"},"html":{"href":"https://github.com/spring-projects/spring-integration/pull/2198"},"issue":{"href":"https://api.github.com/repos/spring-projects/spring-integration/issues/2198"},"comments":{"href":"https://api.github.com/repos/spring-projects/spring-integration/issues/2198/comments"},"review_comments":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198/comments"},"review_comment":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spring-projects/spring-integration/pulls/2198/commits"},"statuses":{"href":"https://api.github.com/repos/spring-projects/spring-integration/statuses/d46e951e9804ddf9f2f9073af9d1a7bc17621ed9"}}}}
{"actor":{"display_login":"smaldini"}}