{"action":"created","issue":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/895","labels_url":"https://api.github.com/repos/Netflix/Hystrix/issues/895/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/Hystrix/issues/895/comments","events_url":"https://api.github.com/repos/Netflix/Hystrix/issues/895/events","html_url":"https://github.com/Netflix/Hystrix/issues/895","id":106241307,"number":895,"title":"HystrixRequestContext in case of async requests","user":{"login":"amitcse","id":431013,"avatar_url":"https://avatars.githubusercontent.com/u/431013?v=3","gravatar_id":"","url":"https://api.github.com/users/amitcse","html_url":"https://github.com/amitcse","followers_url":"https://api.github.com/users/amitcse/followers","following_url":"https://api.github.com/users/amitcse/following{/other_user}","gists_url":"https://api.github.com/users/amitcse/gists{/gist_id}","starred_url":"https://api.github.com/users/amitcse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitcse/subscriptions","organizations_url":"https://api.github.com/users/amitcse/orgs","repos_url":"https://api.github.com/users/amitcse/repos","events_url":"https://api.github.com/users/amitcse/events{/privacy}","received_events_url":"https://api.github.com/users/amitcse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-09-13T21:36:45Z","updated_at":"2015-09-23T20:41:37Z","closed_at":null,"body":"Hi,\r\nIn case when **HystrixObservableCommand** is used to wrap a non-blocking observable, and the non-blocking request is done on ExecutorService, (the subscription is also done on the executor service)  will the **HystrixRequestContext** have to be explicitly copied to the newly created threads for the **HystrixObservableCollapser** to work ??\r\nThe HystrixObservableCollapser is used in Rx composition (flatMap). "},"comment":{"url":"https://api.github.com/repos/Netflix/Hystrix/issues/comments/142722265","html_url":"https://github.com/Netflix/Hystrix/issues/895#issuecomment-142722265","issue_url":"https://api.github.com/repos/Netflix/Hystrix/issues/895","id":142722265,"user":{"login":"ruhkopf","id":558375,"avatar_url":"https://avatars.githubusercontent.com/u/558375?v=3","gravatar_id":"","url":"https://api.github.com/users/ruhkopf","html_url":"https://github.com/ruhkopf","followers_url":"https://api.github.com/users/ruhkopf/followers","following_url":"https://api.github.com/users/ruhkopf/following{/other_user}","gists_url":"https://api.github.com/users/ruhkopf/gists{/gist_id}","starred_url":"https://api.github.com/users/ruhkopf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruhkopf/subscriptions","organizations_url":"https://api.github.com/users/ruhkopf/orgs","repos_url":"https://api.github.com/users/ruhkopf/repos","events_url":"https://api.github.com/users/ruhkopf/events{/privacy}","received_events_url":"https://api.github.com/users/ruhkopf/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T20:41:37Z","updated_at":"2015-09-23T20:41:37Z","body":"Ok, thanks for getting back. I was afraid this would be the answer. ;-)\r\n\r\nUnfortunately this means I will have to change my API. Currently, I only expose `Observable`. In fact, the caller is not even aware that Hystrix is used in the implementation. But in order to change the command settings (GLOBAL) or to use an entire differently command (`HystrixObservableCommand` instead of `HystrixObservableCollapser`), I need to either expose those, or perhaps add a flag `boolean useRequestScope` or similar to the method signature. (To be clear: I don't want to change the command default settings; 99% of the cases we don't use it in the background.)\r\n\r\nI noticed another thing, too: I was surprised to see my real world code fail, even when not using the collapser. I compared it with your example (thanks, btw, for providing it) and could not find a difference. Then I started debugging and saw the following code in `AbstractCommand`:\r\n```\r\nif (concurrencyStrategy instanceof HystrixConcurrencyStrategyDefault) {\r\n // if we're using the default we support only optionally using a request context\r\n if (HystrixRequestContext.isCurrentThreadInitialized()) {\r\n   currentRequestLog = HystrixRequestLog.getCurrentRequest(concurrencyStrategy);\r\n } else {\r\n   currentRequestLog = null;\r\n }\r\n} else {\r\n // if it's a custom strategy it must ensure the context is initialized\r\n if (HystrixRequestLog.getCurrentRequest(concurrencyStrategy) != null) {\r\n   currentRequestLog = HystrixRequestLog.getCurrentRequest(concurrencyStrategy);\r\n } else {\r\n   currentRequestLog = null;\r\n }\r\n}\r\n```\r\nI am using a custom `HystrixConcurrencyStrategy`. (My project has it's own version of a context, that we need to propagate). So the command fails, because it always tries to use the request log. In the source code it says:\r\n\r\n> // if it's a custom strategy it must ensure the context is initialized\r\n\r\nI'm confused by this comment. Why must it be ensured? Why not optionally? Unforuntately this breaks my code. Do you think this is something that could be changed?"}}