Comments (1)
For this answer:
Currently link function module subrequest is only supporting sequential call (sync), and it is still under beta version.
I will recommend you try to use aio threads to pass request into your apps layer, and make async(future) call in your apps. After that add the result into headers input for proxy request purpose.
Assume that you are using c++ application linking, there are many async http client in c/c++. such as
Boost.Asio
backcurl
restclient-cpp.
void bunchOfRequests(ngx_link_func_ctx_t* ctx) {
// ( "Async calling");
http.AsyncCall(.........);
// Request done, add to header for next request
ngx_link_func_add_header_in(ctx, "myResult", strlen("myResult"), result->data, result->len);
ngx_link_func_add_header_in(ctx, "myResult2", strlen("myResult2"), result2->data, result2->len);
ngx_link_func_add_header_in(ctx, "myResult3", strlen("myResult3"), result3->data, result3->len);
// if you are proxy route to another, do not make response content, that's all !!
}
aio threads=myThreadPools;
location /oneBunchRequestAndRoute {
ngx_link_func_call 'bunchOfRequests';
proxy_pass http://xxxxxxxxxx;
}
from nginx-link-function.
Related Issues (14)
- Could this be somehow used with golang? HOT 6
- How to get the value of a config file param during cycle init? HOT 2
- For windows dll HOT 2
- nginx: [emerg] unknown directive "ngx_http_c_func_link_lib" in /home/aimso/nginx-c-function/t/servroot/conf/nginx.conf HOT 3
- `ngx_link_func_init_cycle()` not found on FreeBSD HOT 12
- Make header installation after building HOT 4
- unknown directive "ngx_link_func_lib" HOT 5
- Nginx gzip filter compatibility issue HOT 4
- Facing client request blocking issue? HOT 1
- ngx_http_c_func_module.h not found in your system c header path, please copy latest ngx_http_c_func_module.h to your /usr/include or /usr/local/include HOT 2
- Logging? HOT 2
- Authentication Phase are not support for nginx-c-function with nginx -1.13.3 and below. HOT 1
- How to subrequest in async way by using `ngx_link_func_subrequest ` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx-link-function.