C
Colin Peters
My requirement is to have a windows service that monitors 2 data stores.
When there’s a change in one it should be written to the other. One
data store is a local DB, and the other is remote and is accessed
through a http-based interface. The data stores aren’t mirrors of each
other; they just contain some common data that needs to be synchronised.
Each data store already exposes a method for determining if there is
anything to be synchronised.
My initial thought is that the service launches a thread that will poll
each data store at regular intervals. (This would be done in a thread
because the “queries” can take many seconds, and I want the service to
still respond to system message during this time). If it discovers
updates to be made, it will then write them to the other data store. The
thing is, the remote data store can be quite slow, so I’ll need to have
different polling frequencies for each end. Also, I want to ensure that
the last transaction with a particular store is finished before I launch
the next one. For example, I read from localStore, and determine that an
update to remoteStore needs to be made. During the time that the
remoteStore is being updated I don’t want to perform a query on
remoteStore; there's no point, because it's busy doing its' update.
Clearly some kind of workflow/queuing mechanism is required that can
respect my wish to have at most 1 connection to each data store. And
maybe some well-established framework for keeping track of what changes
are pending/timed out etc. Does C#/.Net provide any interesting
namespaces and classes to prevent me having to hand-roll my own
implementation?
Just a few links or topic names would be great.
Thank you
When there’s a change in one it should be written to the other. One
data store is a local DB, and the other is remote and is accessed
through a http-based interface. The data stores aren’t mirrors of each
other; they just contain some common data that needs to be synchronised.
Each data store already exposes a method for determining if there is
anything to be synchronised.
My initial thought is that the service launches a thread that will poll
each data store at regular intervals. (This would be done in a thread
because the “queries” can take many seconds, and I want the service to
still respond to system message during this time). If it discovers
updates to be made, it will then write them to the other data store. The
thing is, the remote data store can be quite slow, so I’ll need to have
different polling frequencies for each end. Also, I want to ensure that
the last transaction with a particular store is finished before I launch
the next one. For example, I read from localStore, and determine that an
update to remoteStore needs to be made. During the time that the
remoteStore is being updated I don’t want to perform a query on
remoteStore; there's no point, because it's busy doing its' update.
Clearly some kind of workflow/queuing mechanism is required that can
respect my wish to have at most 1 connection to each data store. And
maybe some well-established framework for keeping track of what changes
are pending/timed out etc. Does C#/.Net provide any interesting
namespaces and classes to prevent me having to hand-roll my own
implementation?
Just a few links or topic names would be great.
Thank you