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.
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
-
1Please don't cross post to multiple sites. Please read about asking appropriate & good questions for a site. How to Askphilipxy– philipxy2020年09月13日 05:45:04 +00:00Commented Sep 13, 2020 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– overexchange2020年09月13日 05:56:29 +00:00Commented Sep 13, 2020 at 5:56
-
@philipxy I learnt that SE site is more appropriate for such questionsoverexchange– overexchange2020年09月13日 05:58:18 +00:00Commented Sep 13, 2020 at 5:58
1 Answer 1
My first comment is that integrating through a database is an anti-pattern. You should strongly consider a different approach.
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.
-
How can an application doing the insert also trigger event? Because we do not want
ap2
to know the existence ofap1
.overexchange– overexchange2020年09月13日 17:07:29 +00:00Commented Sep 13, 2020 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– overexchange2020年09月14日 05:20:25 +00:00Commented Sep 14, 2020 at 5:20
-
2"How can an application doing the insert also trigger event?" –
ap1
doesn't have to directly trigger an event inap2
, it can publish the event to a message broker (like RabbitMQ or Kafka).ap2
can subscribe to this event in the broker. This wayap1
andap2
don't know about each other, they only know about the broker.Archie– Archie2020年09月15日 13:04:43 +00:00Commented Sep 15, 2020 at 13:04 -
@Archie if I use kafka, then why would I need database?overexchange– overexchange2020年09月23日 04:15:39 +00:00Commented Sep 23, 2020 at 4:15
-
Because Kafka in not a database. Neither is RabbitMQ which I have also mentioned.Archie– Archie2020年09月23日 07:09:29 +00:00Commented Sep 23, 2020 at 7:09
Explore related questions
See similar questions with these tags.