[nanomsg] Re: REQ/REP worker example

  • From: Achille Roussel <achille.roussel@xxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Thu, 12 Jun 2014 22:47:23 -0700

If you are using the C API you need to create the socket with AF_SP_RAW, then 
you can retrieve some kind of identifier with the control headers (see 
nn_sendmsg) then reuse this identifier when sending the reply to specify which 
request it corresponds to. 
Sorry I'm not more accurate in the description, I don't have access to the docs 
right now.

Some language bindings provide higher level abstractions to this mechanism, are 
you using nanomsg with another language than C?

Achille Roussel
+1 415 490 6339

> On Jun 12, 2014, at 10:04 PM, Ramakrishna Mallireddy 
> <ramakrishna.malli@xxxxxxxxx> wrote:
> 
> I am new to nanomsg and I am looking to implement a client/server service 
> using REQ/REP.
> 
> Server is a stateless service, but depends on another google service for 
> reply to incoming requests. REP Service should be either asynchronous, so 
> that it can handle other REQ requests in the queue while data gets ready form 
> google service, or it should start workers[ideally from pool] to process REQ 
> request in the queue.
> 
> But I have not found any examples that does anyone of the above or may be I 
> am missed some docs.
> 
> The example req/rep is targeted at synchronous REP implementations.
> 
> I am looking for, how to start a worker / create a pool of workers at service 
> start and assign worker to each incoming request.
> 
> Or, with asynchronous REP how can I send the reply to the appropriate/correct 
> client/REQ when data gets ready.
> 
> I have seen a thread regarding SP RAW that can be used, but not sure how it 
> helps in my case.
> 
> I appreciate any help or guidance.
> 
> Thanks
> R K.
> 
> 

Other related posts: