This is used in conjunction with the workshop at https://github.com/datastaxdevs/workshop-intro-quarkus-cassandra.
This version has a build-time property (not overridable at runtime) called astra-service.type
. By default, if this property is undefined OR has the value cql-session
, then CqlSessionAstraService
will be injected as the implementation for AstraService
. This version uses hand-crafted CQL queries executed against the CqlSession
.
If, at build time, astra-service.type=dao
, then MapperAstraService
will be used instead. This version will use the Cassandra Entity Modeling.
The AstraConfig
class contains everything needed for reading this flag at build time and injecting the appropriate AstraService
implementation.
A mix of blocking vs reactive endpoints has been done. In TodoResource
, the getTodos
(GET
to /api/todo/{list_id}
) and setTodo
(POST
to /api/todo/{list_id}
) methods are implemented as reactive methods. This means that their execution happens on the event loop thread, whereas all of the other methods are blocking. Quarkus will offload those executions onto worker threads (read about Quarkus smart dispatching for more information).
Subsequently, the getTodos
and setTodo
methods in AstraService
have been updated to be reactive. Both the CQL and entity mapper implementations have been updated to use the Cassandra driver's reactive support as well.
As you can see, blocking & reactive can co-exist in the same class!