0

Application component 1(ap1) record/insert/update a new state in graph database(neo4j)

For every new state change in the database, application component 2(ap2) needs to be informed/notified that a new entry(event) is made. ap2 would not like to poll database and track/find for state change.

enter image description here


ap2 should not know the existence of ap1

Both application components will be written in GoLang

Database supports triggers & Stored procedures functionality. It is neo4j database.

OS Environment is Linux

I came across this article on notification: http://graphdb.ontotext.com/documentation/free/notifications.html

What is the design pattern to make ap2 listen to any new event(immediately) on a database update? without ap2 tracking & polling state changes in database

  • 1
    Please don't cross post to multiple sites. Please read about asking appropriate & good questions for a site. How to Ask – philipxy Sep 13 at 5:45
  • @philipxy We are stuck with this design scenario... that we are looking to resolve. Question is very clear and precise. Instead of polling database for data changes, application layer needs notifications of those. Isn't this clear? – overexchange Sep 13 at 5:56
  • @philipxy I learnt that SE site is more appropriate for such questions – overexchange Sep 13 at 5:58
2

My first comment is that integrating through a database is an anti-pattern. You should strongly consider a different approach.

https://www.ben-morris.com/a-shared-database-is-still-an-anti-pattern-no-matter-what-the-justification/

That said, Domain Driven Development has the concept of Domain Events that you might want to look into https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/domain-events-design-implementation

It might be that the insert/update is not related to a domain event. Then you might want to consider to have the application doing the insert also trigger the event.

| improve this answer | |
  • How can an application doing the insert also trigger event? Because we do not want ap2 to know the existence of ap1. – overexchange Sep 13 at 17:07
  • I don't agree with Ben morris. Arista EOS is designed on same pattern. CA NSM is designed on same pattern. – overexchange Sep 14 at 5:20
  • 2
    “How can an application doing the insert also trigger event?” – ap1 doesn't have to directly trigger an event in ap2, it can publish the event to a message broker (like RabbitMQ or Kafka). ap2 can subscribe to this event in the broker. This way ap1 and ap2 don't know about each other, they only know about the broker. – Archie Sep 15 at 13:04
  • @Archie if I use kafka, then why would I need database? – overexchange Sep 23 at 4:15
  • Because Kafka in not a database. Neither is RabbitMQ which I have also mentioned. – Archie Sep 23 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.