How to pass data items through events but not store them in the events data column

Skip to first unread message

Gorton Zhao

Dec 11, 2014, 5:23:22 PM12/11/14

I am using the NCQRS for a project. I need pass on some data items through the NCQRS events but I do not want them to be stored in the data column of events database table. For example, I have some customer payment details to be written to my Read Model database. I want to deal with them using CQRS pattern and save them into the read model database table via Denormalizers. I cannot have the payment details visible in the events table in this case. Does NCQRS system provide any API function to update event table or handle the situation like my one?  Any suggestions or ideas would be appreciated.

Thanks and regards, Gorton ZHAO

Galen Parker

Dec 11, 2014, 6:20:44 PM12/11/14

I wouldn't be saving any customer sensitive details to my events in the case of payments.

I've just modelled an online payment flow with the following bounded context: orders, payments

My orders context handles commands/events in preparing the shopping cart, getting the order put together including the order line items, tax, totalling, discounts, customer details etc.... My saga/process manager for my PendingOrderAwaitingPayment aggregate listens for events raised by the Payments bounded context.. PaymentProcessedSuccessfully, PaymentUnsuccesfullyProcessed.

We use stripe or paypal to actually process the payment but the event data that is stored isn't too sensitive... E.g. transationId, receipt No, errorcode, errormsg etc.

What I'm trying to highlight is that i dont think its good practice to have your customers actual sensitive details in the events themselves. You should be able to design around this problem and save yourself problems.


You received this message because you are subscribed to the Google Groups "ncqrs-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Adam Greene

Dec 11, 2014, 6:25:43 PM12/11/14

If you use JSON.NET to serialize to DB then just add [JsonIgnore] to fields to remove them from event serialization.  I know its not the best but if you have to do it, this is one way.  The issue is that events are not replayable.

Gorton Zhao

Dec 15, 2014, 8:09:39 PM12/15/14
Thank you, Adam and Galen, for your responses.

I have another question. According to NCQRS documentation, a command should usually update the database or send a data to remote service via the Denormaliser (events). Can I call another command inside the Denormalizer event method? It does not seem me to be able to do it as the NCQRS throws the exception says that there is already a unit of work created for this context. If a command fails updating the ReadModel database, how will this NCQRS update or add another event to record this failure?

Thanks and regards, Gorton

You received this message because you are subscribed to a topic in the Google Groups "ncqrs-dev" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
0 new messages