What should the payload of a "domain event" generated through "change data capture" include?

Using domain driven design and event sourcing ...
Given I have a table of 3 columns: (A, B, C) with an existing row of data: (1, 2, 3), when I update the row to contain values (1000, 2, 3) and I run a tool designed to capture data changes and emit associated events, which of these should I expect as the
emitted event's payload?
{date: 1234, newState: (1000, 2, 3)}
{date: 1234, prevState: (1, 2, 3), newState: (1000, 2, 3)}
{date: 1234, prevState: (1, 2, 3), newState: (1000, 2, 3)}, changed: (1,0,0)}
{date: 1234, newState: (1000, 2, 3), changed: (1,0,0)}
{date: 1234, changedData: (A: 1000)}
{date: 1234, changedData: (A: 1000), previousData: (A: 1)}
"Ideally" would like the design of the events to support wide variety of current and future uses including:
data replication
audit logging
event triggered activities
retroactive event insertion (possibly)
My thoughts:
Answer 1. above is the simplest, but clients that don't care about the "A" column still end up having to react to this event, as they can't tell from the event itself what's changed.
Answer 5. above is the cleanest - it just captures the "difference". The downside is that it forces the client to roll up changes to display an audit log of the full state on each change. Also event triggered activities may require knowledge of
the full state to work.
Answer 4. above is perhaps more generally useful? It carries what's changed, but some contextual information alongside it.
Answer 2. above falls into a trap of asserting what the previous state was. What if that's not the previous state in your datastore, perhaps in a test environment? Do you reject the event as invalid? Would retroactively inserting an event mean changing
all subsequent events "previousState" fields?

You have two competing demands, and I think you need to choose which of them you want to win. Demand 1, to have a fixed record of the state in each event. Useful for quick auditing by scanning the raw messages
Demand 2, to have a record of the changes applied in each event, to facilitate event sourcing.
Those two demands seem only subtly different, why not do both? Within that subtlety, however, you'll find that they are utterly conflicting. Demand 1 specifies that the knowledge of, and hence control of the mutation of state occurs with the sender, as it has
absolute knowledge of the state (either before or after the change). Demand 2 specifies that the knowledge of, and control of state mutation occurs in the receiver.
Demand 2 is suitable for event sourcing (recording that a change is requested), demand 2 is not, it is, as you say, more of an audit log (recording that a change has occurred)
So, for that reason, since you want to do event sourcing, the only possible workable format is 5.
Part of this is likely caused by the fact that you are coming at event sourcing by listening to mutation occurring in a database, whereas it should be the other way round, events causing the mutation to occur.
That's not to say that you can't get your scheme to work, and satisfy your requirements well, just don't think of it as event sourcing, as that's not what you actually want.
Adopting an event sourced data setup would support your needs above somewhat more easily, but adapting existing systems to that can be very involved to do.

Similar Messages

  • What is the right way to handle events?

    What is the right way to handle events? If I start doing stuff in the AWT event thread (particulaly things that create their own events) should I be starting a new thread?
    A link to a good book or reference source will do
    thanks in advance

    http://java.sun.com/docs/books/tutorial/uiswing/events/

  • What should the"default behavior" be for WiFi network connections?

    I Have been able to at least temporarily fix the plethora of problems encountered after downloading Mountain Lion to my 2009 17" MBP just ten days ago.  Thanks to the time and effort of so many posters that are much more savvy than me, I successfully executed the steps suggested in many of the posts and with good results.  It surely beats running down to the Apple store and being told that I am the only one with a problem.
    Okay,  I've  realized that I don't really know what the default behavior of the WiFi network connection should be? 
    Specifically:
    Should the Wi-Fi drop down in Network always be" looking for networks", even though I am obviously on my Network?
    Should the Wi-Fi be connected at all times even when your computer is in sleep mode- or deep sleep mode?  There have been so many problems with Wi-Fi dropping off,slow or hanging loads, etc.
    I unchecked "ask to join networks, in Network preferences thinking it might stop looking for networks when it doesn't need to because I'm already on mine.  I do see my neighbors (four neighbors) in the drop down in Network. 
    How do you get into Time Capsule's settings, to check speeds, especially ping?  What should the ideal settings be?
    How do you know if your DHCP license is renewed? I've heard that feature isn't working and may be the culprit to some of the Wi-Fi problems.
    I'll look forward to your help in understanding more about this.  I've been in the support  area a lot lately, I've read plenty of definitions, and explanations of the different options to choose from in Apple's support area, but nowhere have I seen anything that explains what the default behavior should be or perform  like. 
    Thanks, as always.

    Generally, you don't want to tweak the wifi settings. It pretty much takes care of itself. The caveat to that is, of course, if you're experiencing problems.
    The 'looking for networks' behaviour only happens when you log in, wake the mac from sleep OR when you click on the wifi icon. You clicking on it tells the mac  "I want to see what networks are available" - so it does a scan for you to check to see if any new networks have appeared since you last clicked on it (or woke/logged in). In short, if you don't want it to look for new networks, don't click on the icon!
    Unchecking the 'ask to join networks' option only applies when your mac detects a new network (such as when it wakes) that you haven't already authorised; it'll ask you to confirm whether you want to join it or not. Otherwise, if the network is open it'll join automatically. You should keep this selected if you travel around with your Mac. It's a good idea to know what network you're on before you start plugging in passwords or typing other things into the mac.
    There is a utility that you can use for ping and traceroute called 'Network Utility'. Click on the Spotlight icon in the top right of your screen and type "Network' and you should see it at the top of the list. Hit 'return' to open it.
    DHCP licences are normally renewed automatically by your router every 24 hours. Again, there's no reason to be messing about with that unless you're experiencing problems.
    If you're experiencing wifi dropout, let us know, and we'll make some suggestions, but if you're not, you're best leaving your mac to manage the background processes. It knows what it's doing!
    Message was edited by: softwater

  • What should the settings in Preview be if scanning documents and the faxing them

    I'm trying to scan documents using preview and my printer. Once I scan the documents, I save them in dropbox and later fax them using SFax. However, the faxes are coming out blurry and very difficult to read. What should the Preview settings be on? PDF? File Format? How many dots per inch? What are standard settings?

    I am a recently retired webmaster and fortunately have fewer eye problems than most people my age. I have astigmatism and, in common with most people over 40, have reduced accommodation. Perhaps because I have spent considerable time in front of computer screens my eyes focus most easily at screen distance. I use low power long distance glasses to watch television and drive after dark. I use low power reading glasses for small print such as maps and repairing small items. Most of the time I don't need glasses.
    There is no such thing as standard settings for font size or style. It is entirely a matter of personal preference.
    Here are my settings:
    34cm x 27cm Apple Studio Display set to millions of colours and a resolution of 1280 x 1024
    Safari 'standard' font set to Geneva 14
    Safari fixed width font set to Courier 14
    Default encoding set to Western (ISO Latin 1)
    Minimum font size set to 10
    Geneva is a very old Apple font optimised for screen use. I still find it more readable than other fonts under a wide range of conditions.
    I assume you know about Zoom settings to override the above:
    cmd + to increase size
    cmd - to decrease size
    cmd 0 to return to 'normal' size
    I set 'Zoom Text Only' on the view menu.
    You can also create your own style sheet to obtain even more control. Here is a Google search link about these:
    https://encrypted.google.com/search?q=browser+%27style+sheet%27+%27visually+impa ired%27&as_qdr=all&newwindow=1&num=100
    I have written many style sheets but not for visually impaired. I am happy to assist if required.

  • What should the default tablespace be for SAP users

    I'm using Oracle 10.2.0.4
    For the users
    OPS$<SID>ADM
    OPS$ORA<SID>
    SAP<SID>
    what should the default tablespace be
    PSAP<SID>USR or PSAP<SID>

    Hello Bill,
    > For the users
    > OPS$<SID>ADM
    For this user the default tablespace is SYSTEM
    > OPS$ORA<SID>
    For this user the default tablespace is SYSTEM
    > SAP<SID>
    For this user the default tablespace is PSAPPRDUSR
    Regards,
    Federico Biavati

  • Recording external synth/drum machine - What should the highest peak be?

    Hi,
    When recording the audio from an external synth/drum machine what should the highest peak be? At the moment I have been recording as loud as possible without clipping but is it better to leave a few DB of headroom if using compressors etc afterwards?
    Thanks for the help.

    It is good practice with all audio tracking to have it peaking at around -6. I sometimes aim for around -9 when tracking.
    make sure you are recording at 24bit. Your peeks can be -18 and you wouldn't suffer too much.

  • What is the best program for designing event flyers? I am looking for something basic and simple.

    What is the best program for designing event flyers? I am looking for something basic and simple.

    Poor old Photoshop® is forever being put down when it comes to layout work, but it is perfectly capable, and can output a high quality print PDF the printer will be perfectly happy with.  OK you don't have the text flow between columns bells and whistles of InDesign and [spit] Publisher, but if you have a $10/month Photoshop/Lightroom subscription, instead of the $50/month full subscription, don't think you can't do a perfectly good flyer or poster.
    https://helpx.adobe.com/photoshop/how-to/align-objects-guides.html

  • What is the main use of domain other than providing technical attributes

    frends let me know what is the main use of domain other than providing technical attributes

    hi RajaReddy,
    Domains are used to
    <b><u>1. specify fixed value ranges.</u></b>
    For eg: <b>status type Char 1</b>, can have fixed values stored in the domain level
    as '1' - Active '2' - retired '3' - terminated '4'- temporary..etc
    <u><b>
    2. Conversion routines are attached at domain level</b></u>
    <u>
    Conversion routine <b>MATN1</b> (connected function modules are CONVERSION_EXIT_MATN1_INPUT
    CONVERSION_EXIT_MATN1_OUTPUT),  is attached for domain MATNR
    <b>3. Value table are atttached at domain level (if fixed value ranges are not mentioned)</b></u>
    for eg: value table mara is attached for Domain MATNR.
    <u><b>
    4. And most importantly, domains can be re-used for multiple data elements, in the same table.</b></u>
    Hope this helps,
    Sajan Joseph.

  • I have receive my new ipad 2 last wek and found scratched behind.what should the steps to cliam at JB area

    I have receive my new ipad 2 last wek and found scratched behind.what should the steps to cliam at JB area

    The iPad was sealed in the box when I got it. It had the plastic screen protector wrapped all around it and when I powered it on for the first time it displayed the "connect to iTunes for setup" message displayed. The only other thing I can think of is if the person I bought it from had ordered it through Verizon on and the iPad was set up on a number on his pre-existing verizon account. My question is should I just keep using it and consider myself lucky? Since there is no way for Verizon to charge me for the usage because I never signed a contract. I realize that if it is on the account belonging to the person I bought it from, they will eventually figure this out and shut it off. But I might as well use it in the meantime right?

  • What type of license should the user be assigned when passing transactions through the DI Server?

    What type of license should the user be assigned when passing transactions through the DI Server?
    We used to assign indirect access licenses to users that were just using the DI Server.  We have one add-on developer that says that the user has to be a Profession license. Current environment is SAP B1 9.0 PL10.  My understanding was that you could have up to 10 users assigned to a single DI Server license.

    Hi,
    From the license guide,
    Indirect Access – has access to any SSP solutions (developed with the SAP Business One DI-API) only. The Indirect Access license is bundled with the DI server. Users who have an Indirect Access license can access a limited number of application forms, but cannot perform any functions with the SAP Business One application. Users who have an Indirect Access license can access an unlimited number of SSP solutions
    Thanks & Regards,
    Nagarajan

  • To imprt  full 9i to 11g what should  the exp parameters

    to imprt full 9i to 11g what should the exp parameters,fist time it was given error some objects r created how to
    import the remaining data, it will support to importing remaining data

    That would be a parameter for import only and not the export.
    Use IGNORE=Y in the import command (that would prevent the object existence errors but not the data duplication errors).

  • What should the multicast rate be set at?

    what should the multicast rate be set at in the wireless options box?
    mine was set at the default of 6 Mbps but could be set higher: 9, 12, 18 & 24Mbps.
    Any care to explain what it does?
    Regards Simon

    That sets the minimum date rate which is valid for a connection. If a connection can't maintain that rate, the connection will drop.
    A side effect of setting it higher is that your usable range will decrease. You will need to be closer to the base station to maintain a higher data rate.

  • My sound no longer works on my Apple 5c cell phone.  What should the settings be?

    My sound no longer works on my phone.  What should the settings be?

    What do you by "what should the settings be?  Volume is either up or down.

  • What Should the template form have ?

    What Should the template form have ?
    Object Library ; which has the most common used inherited triggers ?
    and ???
    Regards,
    Abdetu...

    If you look at the form of the standard object library (OFGWEBOL.fmb) you will see that there is no code (except for a few program units). The OL is really meant for look and feel kind of stuff.
    Also, it is far easier to maintain code in a pll library.

  • What should the WIFI download spped of the ipad be?

    What should the WIFI download speed of the ipad be?

    I'm running a 12 MGPS DSL connection and get pretty much the same download performance on all devices. Upload speeds seem to favor the Mac Book, but only slightly.
    But obviously this would be impacted by a number of factors, including the somewhat less powerful reciever on the iPad compared to the laptop.
    At any rate, speed on the iPad is more than adequate.

Maybe you are looking for