top

Package redisbroker implements a juggler broker using redis as backend. RPC calls and results are stored in redis lists and queried via the BRPOP command, while pub-sub events are handled using redis' built-in pub-sub support.

Call timeouts are handled by an expiring key associated with each call request, and in a similar way for results. Keys are named in such a way that the call request list and associated expiring keys are in the same hash slot, and the same is true for results and their expiring key, so that using a redis cluster is supported. The call requests are hashed on the call URI, and the results are hashed on the calling connection's UUID.

If an RPC URI is much more sollicitated than others, it can be spread over multiple URIs using "RPC_URI_%d" where %d is e.g. a number from 1 to 100. Clients that need to call this function can use a random over that range to spread the load over different cluster nodes, or a server handler can alter the URI to achieve that result without impacting clients.

Imported only in test by 2 package(s)

  1. github.com/PuerkitoBio/juggler
  2. github.com/PuerkitoBio/juggler/callee

Imports 5 package(s)

  1. github.com/PuerkitoBio/juggler/message
  2. github.com/PuerkitoBio/redisc
  3. github.com/pborman/uuid
  4. github.com/PuerkitoBio/juggler/broker
  5. github.com/garyburd/redigo/redis

Test imports 3 package(s)

  1. github.com/PuerkitoBio/redisc/redistest
  2. github.com/stretchr/testify/assert
  3. github.com/stretchr/testify/require