I'm involved into distributed application using vert.x and verticles.
We have to trasfer streams over vericles on demand.
I've found two reasonable solutions. For clarify:
- REQ - requesting data verticle;
- RPL - verticle that replies;
SOLUTION 1
- REQ
- sends request via event bus for specified stream resource;
-
RPL
- accepts request,
- optionaly perform desired operation for preparing stream
- opens new tcp socket for streaming
- replies to REQ with connection information (adress, port, and other stuff like one time random generated passcode).
- awaits for specified time for connection:
- if no one connects, closes socket
- if client connects (here we can verify pass code) provide requested stream and closes socket on EOF.
-
REQ
- once reply is recieved connects to RPL newly opended socket and grabs stream
Is that proper vert.x approach?
SOLUTION 2
The other solution is to share stream resorce (database or network share or any other service) and reply with information how to grab desired stream:
- REQ
- sends request via event bus for specified stream resource;
- RPL
- accepts request,
- optionaly perform desired operation for preparing stream
- if necessary uploads steram to thrid party entity (database, network share, other service)
- replies to REQ with information how to grab stream (URI or db query)
- REQ
- once reply is recieved grabs stream
I've found that each solution has some pitfalls, but the question is: what soution would you choose and why?
Aucun commentaire:
Enregistrer un commentaire