c# - Querying the write model for duplicated aggregate root property -


I am implementing the CursS pattern with Event Outsourcing, I connect between NSWers, NewventStore and NES (NSB and AvestStore) I am using). .

My application will regularly check a web service to download and process any file. When a file is received, a command (download file) is sent to the bus, and the file is received by the commandhandler, which creates a new parallel root file and handles the message.

file total route now) I must check that the content of the file does not match any other file content (since the web service guarantee that only the name of the file is unique, and the content Can be duplicated with different names), comparing it and comparing it to the list of hashed content.

The question is, do I have to save the list of hash codes? Is it allowed to check the model of reading it? Public class file: Kulbase {public file (downloadable file CMD, IFile service file download service, IKlamicRealizer service service provider, IBIS bus): It () {// Download the content of the code file Deserialize it, publish it and publish an event. }} Public Category FileCommandHandler: IHandleMessages & lt; DownloadFile & gt ;, IHandleMessages & lt; ExtractFile & gt; {Public void handle} (For example, is it possible to do this? (Honestly, I do not think it is so, because the reading model should always be stale!) Var file = readModelContext.GetFileByHashCode (hash (Command.FileContent); If (file! = Null) throw a new exception ("file content matches file already downloaded"); // Since there is no way to query an event source such as file content: // eventSourceRepository.Find & lt; File & gt; (C = & gt; c.HashCode == hash (command.FileContent)); }}

It depends on a lot of things ... being one of them Due to input But whenever you are facing this problem in a "bridge-based" fashion (you are asking for a survey for work (downloading and analyzing a file), without worrying about the collision This whole process can create serials. Now he can not give the desired rate at which you want to handle "work", but more importantly ... have you measured? Let's assume that the serial is not going to work for a minute and assume that. What are we talking about? Some 100, 1000, ... millions? Depending on that hash, you can fit in the memory and if / when the process goes down, then it can be made again. The opportunity to split your problem on the axis of time or context can also be the beginning of the morning or just today, or maybe every file since the file files of this month? In fact, I think you should go deeper in the place of your problem. In addition, this event feels like a strange problem to use sourcing, but YMMV.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -