1

In a containerized microservice I'm using the dapr.io state management system as a data cache of equipment; providing a highly efficient way of accessing many equipment status at scale.

Using a simple CRUD approach, I can create, read, update and delete equipment statuses using dapr as follows:

  • POST equipment/
  • GET equipment/key
  • PUT equipment/key
  • DELETE equipment/key

And my main problem is getting a list of all keys:

  • GET equipment

As dapr doesn't support a list of all keys in the state store, I need to track all keys separately using my own implementation.

https://github.com/dapr/docs/tree/master/concepts/state-management

I've tested two methods so far:

  1. SAGA pattern where POST/PUT/DELETE equipment calls publish events to an index API
  2. Manually manage the index in the equipment microservice POST/PUT/DELETE calls

In my view, the above methods add unnecessary complexity and create scale issues.

Is there a pattern for implementing a list of all keys using dapr without the above complexity?

  • As of today, December 9th 2020, there is an open issue for Dapr to support this feature. It includes filtering support too. Please, follow it on https://github.com/dapr/dapr/issues/1339 – Artur Souza Dec 10 '20 at 01:50

1 Answers1

1

Since release 0.10.0 there is an state API operation to get bulk state: https://github.com/dapr/docs/blob/master/reference/api/state_api.md#get-bulk-state

Kai Walter
  • 3,485
  • 2
  • 32
  • 62