Spring Reactive Neo4j

Spring Reactive Neo4j Average ratng: 4,1/5 3282 votes

If you have multiple transactions in the same thread or the same reactive stream, SDN/RX will take care that you will read your own writes. It makes use of the bookmarking mechanism provided. Jan 31, 2020 Starting with version 4.0 Neo4j will support the reactive programming model. To provide this feature for the Spring (Data) community, we decided to re-create Spring Data Neo4j from scratch purely. I'm starting a new Spring boot project and I've chosen a neo4j graph database as there is a lot of connected data. I would like to use Reactive Streams in the project as there is a lot of push notifications from the server to the client. I'm looking at using Spring Webflux for this reason. Spring Data Neo4j - or in short SDN - is an ongoing effort to create the next generation of Spring Data Neo4j, with full reactive support and lightweight mapping. SDN will work with immutable entities, regardless whether written in Java or Kotlin.

This article is about the spring data for neo4j database. Neo4j is a popular graph database.

Spring Data Neo4j module is there which is support only imperative style and currently, it’s only in support and maintenance.

Prerequisites:-

You head this article that means you at least heard about Neo4j and spring boot. below are the prerequisites

  1. Neo4j (https://neo4j.com/graphacademy/online-training/introduction-to-neo4j-40/)
  2. Installation of Neo4j on local or use Neo4j sandbox.
  3. Knowledge with spring data and spring boot.
  4. For this example, we are using JDK 11.

If you don’t know anything about the above things then I will recommend you should start exploring these things and come back.

In this example, I am using Neo4j sandbox environment: https://neo4j.com/sandbox/

Advantages of using SDN-Rx:

  1. It supports both imperative and reactive development.
  2. Built-in OGM(Object graph mapping) and very lightweight.
  3. Support immutable entities for both Java and kotlin.
Spring data neo4j example

Maven/Gradle Dependencies:-

Right now Spring Data Neo4j Reactive starter is not yet part of the official Spring repositories so we have to add that manually, so it won’t be available in the spring initializer website.

PrePare Database:-

Spring Reactive Neo4j System

Reactive

For this article, we are using the Neo4j-standard movie graph database because it’s in small size and it’s available in your sandbox as well as in your local.

use this command to start:

Execute the command and deck is an interactive mode, so its seamless execution. The movie database contains a database such as a movie name, release date, crew, director of movie, a rating is given by different individuals or rating companies. The minimal schema relation could be like this

Create Project:

The best way to start with the spring boot project is start.spring.io. Create a spring boot project.

Do not choose Spring Data Neo4j here, as it will show the legacy generation of Spring Data Neo4j that has only imperative support. Euro truck simulator 2 for mac osx.

Once your project is ready then add the spring data neo4j Rx dependency in your POM or build.gradle.

Configurations:

You can put here your database-specific configurations.

Neo4j Spring Boot

Domain Entity:

All our configurations are done now let us begin and define the domain entity object. As we stated we are using a movie database so we have to create Movie as a domain entity with few properties.

Entities are nodes.

In the movie entity, we defined a movie name, tagline, actors, and directors.

@Node annotation marks the given class is the managed node. @Id annotation to have a unique property and then we defined different relationships using @Relationship annotation. In the same way, we have a Person entity that contains two fields.

In these entities, we just defined one-way relation to have demonstrated things simple but you can also define an entity in such a way to fulfill two-way relationships.

Let us create a repository class then.

This is to demonstrate the reactive programming style so we used here ReactiveNeo4jRepository which is reactive repository implementation.

Neo4j Application

You can hit below endpoints to see the output:

GET http://localhost:8080/movies

DELETE http://localhost:8080/movies/The Matrix

This is it for now.

References:-

Welcome

Spring Reactive Neo4j Free

9:00 - 9:10

Welcome

9:10 - 9:45

Logging in Spring Boot with the Elastic Stack

Philipp Krenn - Elastic

Let’s look at the good parts of logging:
- How can you bring logging to production quickly?
- How does this work with Spring Boot in as a practical example?
- Do you want to add tracing and make the most of the combination?
- How do you manage the data that you are collecting?

9:45 - 9:55

Break

9:55 - 10:30

Spring On Kubernetes

Dave Syer - VMware / Pivotal

Spring has always encouraged developers to leverage the technologies that best solves their business use cases. Kubernetes is emerging as a very popular platform for running cloud native applications, and Spring makes it quite easy to take advantage of all it has to offer in order to run your applications on this powerful platform. Join Dave Syer to get started running Spring apps on Kubernetes.

10:30 - 10:40

Break

10:40 - 11:15

AI on Spring: I love it when an OptaPlan comes together

Geoffrey De Smet - Red Hat

Forget about Machine Learning. Planning optimization is the most profitable AI technology on this planet.
The world is full of planning challenges, such as vehicle routing problems, maintenance scheduling and employee rostering. Find the quickest routes to visit n locations with k vehicles. Assign n shifts to k employees, taking into account skills and avaiability. Few people realize how much AI algorithms improve those solutions. For example, when a big telco started using OptaPlanner to plan their fleet of tens of thousands of technicians, they expected a driving time reduction of 1-2%. It was 25%. That saves them hundreds of millions of dollars and millions of kilograms of CO² emissions, every year.
In this session I’ll show you how to code a highschool timetabling application from scratch, with Spring Boot and OptaPlanner. It ‘ll generate the perfect lesson schedule, for both students and teachers.

11:15 - 11:30

Spring Quizz I

11:30 - 12:05

RSocket - Future Reactive Application Protocol

Oleh Dokuka - Netifi

Are you making microservices/cloud-native applications? Are you frustrated by slow REST? Tired of unreliable gRPC? Do you need faster client-server communication, but don’t want to invent your own WebSocket-protocol? RSocket is a new application-level protocol capable of reactive streaming that can be used to simplify the way enterprises build and operate cloud-native applications. It enables traditional enterprise developers to build sophisticated, cloud-native, distributed applications.
RSocket is transport agnostic and can be used on top of any transport protocol like TCP/Aeron or even on top of HTTP/2 or WebSocket. RSocket has various interaction models so it can satisfy the needs of today applications. The protocol is agnostic when it comes to programming languages, message formats, and API architecture. Any developer can use RSocket to meet all business requirements. RSocket simplifies life for any startup or enterprise, whether it is used in a protocol implementation like Java, C#, C++, JavaScript or deployed in an RPC framework.
In this presentation, we are going to cover all these cases and concepts and answer why, when and how you can start using RSocket today and how high traffic giants like Facebook, Netflix and others have adopted RSocket.

12:05 - 12:15

Break

12:15 - 12:50

Chaos Monkey for Spring Boot

John Fletcher & Manuel Wessner - Codecentric

Everything you want to know about the useful and popular chaos engineering tool Chaos Monkey for Spring Boot (CMSB) from two of its maintainers. Featuring:
- How to easily get started with your first Chaos Experiments.
- How to integrate CMSB with automation tools like Chaos Toolkit in order to run tests in your build chain.
- What to consider when running chaos experiments on a reactive application.
- An overview of the history, the changes in the latest version, and the roadmap.
- Who should get involved in the project, and how.
The talk will primarily consist of live coding.

12:50 - 13:00

Break

13:00 - 13:35

Action plan to become a Spring Certified Professional

Iuliana Cosmina - Cloudsoft

13:35 - 13:45

Break Day of defeat: source crack.

13:45 - 14:20

Spring: your next Java micro-framework

Alexey Nesterov - VMware / Pivotal

Quite often Spring is opposed to so called “micro” frameworks in Java world. “Micro” means different things to different people, but usually it implies reduced runtime footprint and code simplicity. In this talk, I’ll show that you don’t have to abandon your favourite Spring Boot to a new and shiny thing to achieve the same result. Also I’ll show how to find the balance between simplicity and productivity, improve runtime efficiency, e.g. image size, memory footprint, and startup time when using Spring Boot.

14:20 - 14:35

Spring Quizz II

14:35 - 15:10

Bringing together OpenAPI 3 and Spring Boot

Badr Nasslahsen - BNP Paribas

Since July 2017, there are a lot of industries adopting OpenAPI 3 specification to discover and understand the capabilities of a REST API without the need to have access to source code.
springdoc-openapi project, accelerates the generation of OpenAPI documentation for spring boot projects.
IN this talk, will deep dive into springdoc-openapi main functionalities:
- Introduction to OpenAPI 3 and swagger2
- What is the purpose of springdoc-openapi?
- How do we migrate to OpenAPI 3?
- Integration with spring-web and spring-webflux
- Integration of JSR 303 Bean Validation with OpenAPI 3
- Integration with actuator
- Global Exception Handling Using Controller Advice
- Integration with spring- HATEOAS and Pageable
- Integration with spring-security and OAuth 2.0
- Multiple OpenAPI description on the same application and groups support
- Integration with spring-cloud-gateway in a microservices architecture
- Integration with Kotlin
- Generation of the OpenAPI 3 documentation in offline mode

15:10 - 15:20

Break

15:20 - 15:55

Extending Spring Boot for Cloud Deployments

Ray Tsang - Google
Eddú Meléndez - Nubank

Spring Boot and Spring Cloud offers unprecedented abstraction layer that offers solutions to all sorts of common concerns - security, data access, messaging, configuration, caching, distributed tracing, and more. All of these layers also provide extension points to integrate with different underlying implementations. These extension points are crucial when developing cloud native application. For example, when developing a cloud native application that needs to use cloud provider’s messaging system, you may be able to avoid using implementation-specific APIs, instead, use a higher level abstraction such as Spring Integration. In this talk, we’ll what these extensions points are, how to build an extension, and how we realize the benefits in the Spring Cloud GCP project.

15:55 - 16:05

Break

16:05 - 16:40

What the hell, it's 2020 and you're writing a new Object mapping framework? Introducing Neo4j SDN/RX

Michael Simons - Neo4j

What do you get when you bring two people together having a lot of experience as consultants and developers working with object mapping frameworks?
Both of them having enjoyed the simplicity and advanced features that an object mapper brings in regards of
* Mapping
* CRUD operations
* Caching
and both have also suffered from
* Mapping
* Caching
* Bad queries
The Neo4j-Object-Graph-Mapper (Neo4j-OGM) was heavily influence by Hibernate-ORM (Object relational mapping) and that's not a bad thing. Hibernate-ORM addresses a lot of things that make a developers life hard. It originates from a time where databases have been seen as second-class-citizens in a Java applications.
Both me, Michael Simons, and also my colleague Gerrit Meier see the value of working directly with a database, regardless whether it's a graph or a relational database.
At Neo4j, we started a big cross team effort to provide reactive database access to Neo4j, the world's leading graph database, in 2019: We wanted to have an reactive stack, right from the query execution engine, to transport layer, the driver and then at least having one premier data abstraction layer.
The later gave us the opportunity to codify our experience and also our preferences in working with databases in the form of SDN/RX, a new Spring Data Module for Neo4j.
We wanted:
* to attribute the fact that there's no silver bullet in terms of working with databases
* to have composable modules for the Spring eco system, like direct access to Neo4j through the official driver but also integration with Spring's application level transactions
* to have Spring Data powered mapping with all the benefits it brings: Support for immutable classes (Kotlin data classes, Java with a bit of boilerplate or JDK 14 records)
* to cater for larger domains with tons of domain objects without having repositories for each of them
* to have support for reactive infrastructure
In this short introduction I'll show you the building blocks about what the Spring Data Team at Neo4j created based on the experience of working with different database technologies from within Spring Boot.
We will cover starters, auto configuration and of course, all the aspects described above.

16:40 - 16:50

Jamon Battle - Final Round

Spring Reactive Neo4j Group

Have you ever built a cloud microservice that throws jamon at other microservices? Well at Spring I/O Bridge you'll be able to compete with others for the best Battle Jamon algorithm. We will help you deploy your jamon bot on Google Cloud Run to compete for up to $500 in Google Cloud credits. Join the #battle-jamon Discord channel to know more!