c# - CQRS run handlers in specific order -
i have running order 2 handlers deleting , reordering pictures , advises best solution.
on ui pictures deleted, user clicks on deleted button. whole flow, delete command event handler deletes physical files started.
then user sorts remaining pictures. new flow reorder command reordering event handler file system fires again.
already there concurrency problem. reordering cannot correctly applied without having deletion done. @ moment problem handled sort of lock. temp file created , deleted @ end of deletion flow. while file exists other thread (reordering or deletion depending on user actions) awaits.
this not ideal solution , change it. potential solution must pretty fast (off course current 1 not fast one) ui updated thru json call @ end of ordering.
in later implementation thinking use queue of events moment pretty stuck.
any idea appreciated! thank you, mosu'!
edit: other eventual consistency problems had solved using javascript data manager on client side. being optimist , tricking user! :) i'm starting believe way go here well. how know when data changed in file system?
max suggestions welcomed , apply.
it hard explain details of implementation there detail should mentioned: way store pictures means when reordered pictures paths (and links) change.
a colleague hat idea of remove part. means if order change path of picture remain same. on ui side there mapping between picture index in display order , path , means there no need change file system anymore, except when deleting.
as want permissive possible our users best solution us. think, in general, approach when there appears concurrency issue. can concurrency removed?
Comments
Post a Comment