tag:blogger.com,1999:blog-8508935345157628191.post1220556749400409115..comments2024-03-28T21:29:25.773-07:00Comments on Phill Barber's Blog: Lesson learned with Ratpack and RxJava Phill Barberhttp://www.blogger.com/profile/18399785532886246472noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8508935345157628191.post-30028197677063639712016-10-25T06:00:46.449-07:002016-10-25T06:00:46.449-07:00Hi Phil,
Thank you for your response.
I actually ...Hi Phil,<br />Thank you for your response. <br />I actually tried that, but it seems Rx stops the upstream process in case if the timeout triggers. In my case I want the upstream to continue even on a timeout. <br />In the end I managed to get this working by `merging` two separate Observables one produces an event on a time interval the other process the transaction. So whichever triggers first I respond back to client while I still handle the second event differently. <br />Luke Daley also suggested a different approach to my question in https://github.com/ratpack/ratpack/issues/612Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8508935345157628191.post-35401963730154759612016-10-24T14:06:03.634-07:002016-10-24T14:06:03.634-07:00Hi, I have written some code here that does what I...Hi, I have written some code here that does what I think you're after...<br /><br />https://github.com/phillbarber/ratpack-demo/blob/timeout_with_different_responses/application/src/main/java/com/github/phillbarber/service/DownstreamHttpService.java<br /><br />Also see the tests (returnsA200IfOnTime, returnsA202IfLate) here... https://github.com/phillbarber/ratpack-demo/blob/timeout_with_different_responses/application/src/test/java/com/github/phillbarber/service/http/DownstreamHttpServiceTest.java<br /><br />Not sure if that's what you're after or not, but either way I had fun playing with Observables again!Phill Barberhttps://www.blogger.com/profile/18399785532886246472noreply@blogger.comtag:blogger.com,1999:blog-8508935345157628191.post-30228629925017419502016-10-19T03:05:11.191-07:002016-10-19T03:05:11.191-07:00Hi Phil,
I'm have a similar but a slightly dif...Hi Phil,<br />I'm have a similar but a slightly different problem that I'm stuck with. Just wondering if you have any insights to a possible workaround/solution.<br /><br />Basically I have a scenario that needs handling a possible long running request and I need to respond either a 200 or a 202 depending on a certain time threshold is reached. In case of threshold reached, i still need to continue the transaction but respond 202 immediately to client. I tried doing this converting the ratpack promise to rx.Observable's and using timeout / timers but it leads to a bit of a convoluted mess and going nowhere. <br /><br />wonder if you have any suggestions? I also posted this at https://github.com/ratpack/ratpack/issues/612Anonymousnoreply@blogger.com