I am working on parsing a file and inserting records into SQL Server DB.The database table structure will be something like this:
A Users table which contains (id, name, address, destinationName,insertDate, updateDate, updatedBy
). So I will be inserting the parsed data from file in to this table in a batch which occurs once a day. destinationName is the one which I will be using to send the data to a different destination(system)
using Rest Templates
.
So my issue here is I need to send the same records to two different destinations which my rest template will determine using the destinationName from the Users table. I am thinking of two approaches here to do this.
- Insert two similar records with different destinationNames so each rest template will see this records and send it to the destination.
- As the data is same, instead of inserting two records, let rest template handle and determine based on the destinationName.
So please let me know from above both approaches, which is better or is there any other better approach to achieve this.
Any suggestions or better approach would be helpful.
I am using java 8,sql server, spring rest.
userId, destinatonName
) mapping table might be helpful. – Dan Wilson Dec 31 '19 at 17:27