Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example on consuming external web service within request handler #159

Closed
diorahman opened this issue Apr 3, 2017 · 1 comment
Closed

Comments

@diorahman
Copy link

Hi,

It is common to have code that consumes external web service within the request handler. Can we have an example on this case? E.g. call one of the APIs of https://openweathermap.org/api with non-blocking fashion within the request handler, then send back the response from the API to the client.

Thanks!

@diorahman diorahman changed the title Example on consuming external web service withing request handler Example on consuming external web service within request handler Apr 3, 2017
@afrind
Copy link
Contributor

afrind commented Apr 25, 2017

The proxy example is similar to this, except instead of forwarding the original HTTP message, you would just create a new one.

eg: from onRequest, or onEOM, you would use the HTTPConnector to establish a new session, from there create a new transaction and send your request. The Handler object will receive the response and you can process it how you like. If you stream it directly to the client (as the proxy does) the flow control code is also in the example.

@afrind afrind closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants