microchip
microchip

Reputation: 109

Design a ZeroMQ program with a "middlend" interface

In advance, I'm sorry for that kind of question because I'm new to ZeroMQ and after reading cryptic ZeroMQ documentation and write some test cases, I'm stuck on designing my program.

My first version was using a ROUTER (as a frontend) and a DEALER (as a backend). See below :

[ clients N] --> [ Frontend ] --> [ Backend ] --> [ Workers N ]

That's simple and standard so the code works fine. Now, I got something new. After clients N sends a request pre-processing must be done on the payload before sending it to the backend. And you know what? I would like that pre-processing asynchronously.

My actual code uses a ROUTER-TO-DEALER design but now, should I design something like ROUTER-TO-ROUTER-TO-DEALER?

( I read in the documentation ROUTER-TO-ROUTER (N to N) is difficult to design ).

Any ideas?

Upvotes: 1

Views: 77

Answers (1)

Ralf Stubner
Ralf Stubner

Reputation: 26823

I assume you are using something like the rrbroker from The Guide. In that case you could add an additional socket of type DEALER as middleend, to which pre-processing workers can connect. Routing within the broker would be:

  • frontened -> middleend
  • middleend -> backend
  • backend -> frontend

Upvotes: 1

Related Questions