Skip to content

datastaxdevs/quarkus-astra-intro-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is used in conjunction with the workshop at https://github.com/datastaxdevs/workshop-intro-quarkus-cassandra.

Mappers vs Raw CQL

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.

Blocking vs Async/reactive

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!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages