You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/10/31 11:00:37 UTC

[GitHub] [camel] rangoy opened a new pull request, #8646: [CAMEL-18618] Milo component: Return status from write

rangoy opened a new pull request, #8646:
URL: https://github.com/apache/camel/pull/8646

   - [X ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [X] Each commit in the pull request should have a meaningful subject line and body.
   - [X] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   - [X Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [?] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   
   In our usecase we need to get the response from the server when writing values to OPC UA via Milo. 
   
   I've tried to ask on [zulipchat|https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/Result.20from.20camel-milo.20endpoint] and also create an issue on jira without any response.
   
   I tried to run a clean build in the component directory but tests failed both on master and my branch


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus commented on a diff in pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
davsclaus commented on code in PR #8646:
URL: https://github.com/apache/camel/pull/8646#discussion_r1033344642


##########
components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientProducer.java:
##########
@@ -25,6 +25,7 @@
 import org.apache.camel.Message;
 import org.apache.camel.component.milo.MiloConstants;
 import org.apache.camel.support.DefaultAsyncProducer;
+import org.apache.camel.support.DefaultMessage;

Review Comment:
   Remove this unusued import



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
davsclaus commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1298319860

   I would assume future get is available during whenComplete is called


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1296923233

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :warning: Please note that the changes on this PR may be **tested automatically**. 
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] rangoy commented on a diff in pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
rangoy commented on code in PR #8646:
URL: https://github.com/apache/camel/pull/8646#discussion_r1033411332


##########
components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientProducer.java:
##########
@@ -91,7 +92,11 @@ public boolean process(Exchange exchange, AsyncCallback async) {
         final Boolean await = msg.getHeader(MiloConstants.HEADER_AWAIT, this.defaultAwaitWrites, Boolean.class);
 
         if (TRUE.equals(await)) {
-            future.whenComplete((v, ex) -> async.done(false));
+            future.whenComplete((result, throwable) -> {
+                        msg.setBody(result);

Review Comment:
   Ok, I amended the commit where I added that and also removed an unnecessary import also.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1329350492

   ### Components tested:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 1 | 1 | 1 | 0 |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1329094626

   :leftwards_arrow_with_hook: There are either **too many** changes to be tested in this PR or the code **needs be rebased**: (32 components likely to be affected)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] rangoy commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
rangoy commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1298289957

   Hi, thanks for the reply. 
   
   As I said, when I asked at [zulipchat](https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/Result.20from.20camel-milo.20endpoint/near/300812919)  , I was not sure how to do that. Do you have any suggestion how to do that?
   
   > I did an attempt of patching this to be able to get the status from the server, not sure how to get the new body applied without using get()
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus commented on a diff in pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
davsclaus commented on code in PR #8646:
URL: https://github.com/apache/camel/pull/8646#discussion_r1033345986


##########
components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientProducer.java:
##########
@@ -91,7 +92,11 @@ public boolean process(Exchange exchange, AsyncCallback async) {
         final Boolean await = msg.getHeader(MiloConstants.HEADER_AWAIT, this.defaultAwaitWrites, Boolean.class);
 
         if (TRUE.equals(await)) {
-            future.whenComplete((v, ex) -> async.done(false));
+            future.whenComplete((result, throwable) -> {
+                        msg.setBody(result);

Review Comment:
   Ah what if throwable != null, eg I assume there was an error, then its likely better to set response, on the exchange
   
   if (throwable != null) {
   msg.getExchange().setException(throwable);
   } else {
     msg.setBody(result);
   }
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus commented on a diff in pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
davsclaus commented on code in PR #8646:
URL: https://github.com/apache/camel/pull/8646#discussion_r1032763357


##########
components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientProducer.java:
##########
@@ -91,7 +92,13 @@ public boolean process(Exchange exchange, AsyncCallback async) {
         final Boolean await = msg.getHeader(MiloConstants.HEADER_AWAIT, this.defaultAwaitWrites, Boolean.class);
 
         if (TRUE.equals(await)) {
-            future.whenComplete((v, ex) -> async.done(false));
+            future.whenComplete((o, throwable) -> {
+                        final DefaultMessage newMessage = new DefaultMessage(exchange);

Review Comment:
   I dont think you need to set a new message as this leads to loosing headers and whatnot.
   
   You usually just set the result directly on the message, eg
   
   exchange.getMessage().setBody(...)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus merged pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
davsclaus merged PR #8646:
URL: https://github.com/apache/camel/pull/8646


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] rangoy commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
rangoy commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1329099640

   Rebased onto latest main


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] rangoy commented on pull request #8646: [CAMEL-18618] Milo component: Return status from write

Posted by GitBox <gi...@apache.org>.
rangoy commented on PR #8646:
URL: https://github.com/apache/camel/pull/8646#issuecomment-1325250672

   > I would assume future get is available during whenComplete is called
   
   I finally got to this again. For some reason I did not get that to work last time, but this seems to work as intended. I guess parsing of the status value can be left for the consumer. 
   
   ```
     future.whenComplete((o, throwable) -> {
                           final DefaultMessage newMessage = new DefaultMessage(exchange);
                           newMessage.setBody(o);
                           exchange.setMessage(newMessage);
                           async.done(false);
                       }
               );
               return false;
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org