I've encountered some problem when build a IoT service.
My architecture is shown as below:
UserBrowser<------>WebServer<---->NettyServer<----->Client(IoT device, auto response)
Here netty server act as a passthrough proxy which convert Userbrowser
message and web server message to binary stream to remote IoT device, and then IoT device return back some message to user.
I use RocketMQ
to communicate between WebServer
and NettyServer
My question is since http request of UserBrowser is a sync operation, Netty is a async architecture, how to convert an async operation in Netty to sync HTTP request ?
Should I cache the requests and wait for response from IoT , and then return back? in this situation WebServer
is a sync call
Or should I use async always, the UserBrowser poll result from WebServer
?