Closed
Description
Suppose our Nginx instance has 4 workers (worker process not jvm_workers which is just thread number of thread pool in jvm). Now we want to provide sub/pub service. e.g.
- Client A connected to nginx worker A and subscribed to uri
/mychannel/sub
- Client B connected to nginx worker B and subscribed to uri
/mychannel/sub
- Client C connected to nginx worker C and publish a message to uri
/mychannel/pub
So the service at endpoint of /mychannel/pub
must broadcast pub event to Client A and Client B.
Although for large-scale application we can use sub/pub service from Redis on nginx-clojure , for small-scale or medium-scale application this feature will make the dev life easier.
This feature will support two kinds of events to broadcast, simple events and complex events.
- A simple event only has a event id which is a long integer and must be less than 0x0100000000000000L, it hasn't any body or its body is stored in some external stores, e.g. SharedHashMap, Memcached, Redis etc.
- A complex event has a message with a length limitation
PIPE_BUF - 8
, generally on Linux/Windows is 4088, on MacosX is 504.