samedi 3 mars 2018

Which design pattern/ServiceBus pattren will be best fit for different schema xml file processing and notification

I am stuck to choose best approach for below mentioned problem statement

Input: XML (assume any structure of xml file which have BankFundTypes xml element)

" Create a solution that accept xml messages, processes it, and forwards it to any customer interested in the BankFundTypes . When we receive an xml message, write the BankFundTypes information (mentioned in xml) with the current timestamp to a database. At the moment we are aware of Customer A and B . We expect that other Customers will join in the near future, with different requirements regarding message schema and/or protocol. We will enhance the application in a later version to not only save the BankFundTypes, but most of the data mentioned in xml to our database. We expect that the number of messages we need to process will drastically increase till end of the year.

Customer A will get Email Notification in Text type and Customer B will get Email Notification in XML format "

My Approch:

1.Create WCF/Webapi method which will accept xml .If Xml schema or structure will change for new customers then we will implement versioning 
2.When Api method will accept xml,Then we will save file in database and Send command (which will have fileid and CustomerName) to NSERVICEBUS 
3.NserviceBus endpoint handler will process this command .We can get FileId and Customer Name from command message and then parse xml file and retrieve BankFundTypes information from xml and save it to database table. After that we will Publish Event called IBankFundTypeSave with fileId and CustomerName
4.IBankFundTypeSave Event will be subscribed to respective handlers and will send emails to customers. As emails body is different for different customer,hence we will implement AbstractFactory Design Pattern for the same 
5.If Message will be growing drastically ,In That case we can scale enpoint handlers.

Please suggest

Aucun commentaire:

Enregistrer un commentaire