473,547 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event Notification in C++

ashitpro
542 Recognized Expert Contributor
Hi there,

I am working on a distributed service detection project, written in C/C++
Platform is Linux. Each system under network has mysql database for general storage. If first node queries to second node and if request gets satisfied, First node will put these results in its local cache table. So whenever same query gets fired on first node, it would just return the results from its cache table.
The problem arises when second node changes his database table.
First node should get notified that its cache has got dirty.
This is the classical problem of "Dirty Cache Detection".
One solution would be, Each node will store the information of the system whom did he serve. And whenever local database changes, it'd send the message to the other system, notifying that you can clear your cache.
There will be thousands of nodes and above solution will increase the network traffic terribly.
Give me some algorithm or any existing library for this event notification(mu st be efficient).

NOTE:My English is weak. So let me know if you don't understand the problem.

Regards,
Ash
Nov 18 '08 #1
1 4441
weaknessforcats
9,208 Recognized Expert Moderator Expert
This is the classic Observer design pattern.

This pattern is based on a Notify/Publish scenario where an object (your second node) has to notify interested observers (your first node) that the state of the database has changed. The first node then publishes new results by doing a re-query.

If there are many observers, then a Mediator becomes involved where the Mediator is notified and it int turn notitifes all of the observers.

Check out Design Patterns by Eric Gamma, et al. ISBN0-201-63361-2 page 293. All the examples are in C++.
Nov 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4580
by: coder_1024 | last post by:
I've embedded an ActiveX/COM object in my web page (i.e. <OBJECT ID="MyObject1 ...> ... </OBJECT>). I know I can access the object using javascript on the page (i.e. MyObject1.property or MyObject1.method). I'd like to be able to call a method which returns immediately and then later provides notification of progress back to javascript in...
2
1756
by: dubian | last post by:
I would like to propagate an event signal to an external application when a table in my MSSql2000 server is updated. Prog A; I have an external application adding records to a table. Prog B; I have another external application using this table as well. When Prog A creates a new record in the Table, how can I have Prog B be notified of the...
1
10379
by: zfeld | last post by:
I need an event notification when the user types anything in the combobox textfield? I know about the TextChanged Event but the problem is this is also fired when the user selects an item in the combobox which updates the textfield, and there is no way of knowing what fired the event other then that it came from the combobox. I am guessing...
4
13721
by: Charles Law | last post by:
Is there an event or notification that my application can receive when a USB device (or other) is plugged in? I have looked at WMI as this appears to be the right area but cannot see how to get notification when this particular event occurs. The same goes for removal as well. TIA Charles
3
4962
by: SB | last post by:
Having gone through couple of books on .NET web services, I could not find any details event notification. They all cover in detail the coomon request/response web services implementation. I would like to know how to implement the event notification from .NET web services that is related to the publisher/subscriber model. Any sample code or...
1
1499
by: barbara_dave | last post by:
Hi all, I want do Event/Notification when a USB device plugged in. I am working on a Windows 2000 computer. Is there a way to do that? Thanks a lot!
3
5521
by: geskerrett | last post by:
We have been asked to develop and application for a client that is a 'notification" system. We would like to use python, but are struggling to find the right starting point. Any suggestions, tips or sample code would be appreciated. Application outline; Machine A is running a "listener" application that is connected to a another device...
0
1610
by: anitajose | last post by:
Hi, I have a PHP program and a VC++ program. Is it possible, when i click on a button in PHP user screen, I should get an event notification in VC++ service program and do the appropriate action in VC++.. Thank u..
0
1268
by: sanakausar | last post by:
Hi I am working on a web application which is a sort of bidding portal where buyer post their jobs and the service provider bid against them. The application is being developed using EF 4.0 , .Net 4.0 and Sql Server 2008. Now there are a lot of notifications that needs to be generated and send to respective parties/users. Some example of events...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.