# Functionality to pass request context in performRequestAsync and retrieve it from the listener's response

**URL:** <https://discuss.elastic.co/t/functionality-to-pass-request-context-in-performrequestasync-and-retrieve-it-from-the-listeners-response/124966>\
**Category:** Elasticsearch\
**Created:** [March 21, 2018, 10:52am UTC](https://discuss.elastic.co/t/functionality-to-pass-request-context-in-performrequestasync-and-retrieve-it-from-the-listeners-response/124966 "2018-03-21T10:52:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garvitlnmiit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/garvitlnmiit/32/29076_2.png) [@garvitlnmiit](https://discuss.elastic.co/u/garvitlnmiit)\
**Post date:** [March 21, 2018, 10:52am UTC](https://discuss.elastic.co/t/functionality-to-pass-request-context-in-performrequestasync-and-retrieve-it-from-the-listeners-response/124966/1 "2018-03-21T10:52:55Z")

</div>

Currently, if I call performRequestAsync() method then I won't be able to pass request context to it to map request and response by retrieving the request context from the response provided by the listener.

There should be support for it so that it becomes feasible to map request and response and execute appropriate logic for the request and response.

Let's say for a request I call Elasticsearch asynchronously and on receiving the response I want to call another service which takes this response and original request context. For this, I need to know the request context at the time of response.

Request context could be anything which we want to pass on further like order\_id, user\_id, request\_id etc.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 18, 2018, 10:53am UTC](https://discuss.elastic.co/t/functionality-to-pass-request-context-in-performrequestasync-and-retrieve-it-from-the-listeners-response/124966/2 "2018-04-18T10:53:14Z")

</div>

Closed on April 18, 2018, 10:53am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
