c++ - SQL table event store as a queue in Qt App -



c++ - SQL table event store as a queue in Qt App -

i need advice on qt app using qt classes. can take qtnetwork , qsql modules solutions not "3rd party" tools such rabbitmq etc.

i'm using "event store queue" (see greg young page 46) cqrs event sourcing. have simple sql table storing events unique sequential id. thus, can track "event store pointer" used "chasing process".

goal: run multiple processes handle events "pop them queue" ensuring treated once....

at stage have interprocess communication via db (mysql,sqlite) , setup shared table doing ttl (time live) heard beat list. "top" process acting worker. if dies ttl times out , next 1 takes over. top worker cleans out "stale processes". has delay equal @ to the lowest degree ttl eg. 5s not optimal situation.

i allow other processes take on work. alter "top" role worker dispatcher need communication other processes give work (eg. process events 100-200). going via db dispatch not thought in terms of performance can signal event ids via qtcp** classes...not real problem. but, brings other questions mind: happens when dispatcher dies? practice 1 process play worker , dispatcher? fail-over? redundancy? scalability?

i'm sure there must simple solution without breaking head. load balancer? same questions apply. load-balancer dispatcher. seems need maintain heartbeat between processes via tcp. faster....implementing raft protocol overkill @ stage! not sure if other distributed design patterns or protocols apply. have rest framework... maybe atom? pubsubhubhub , webhooks? no websockets since need persist tcp connections...

thought, ideas, suggestions welcome!

you're trying implement queueing mechanism on top of db worth it? see scheme can not afford loosing messages, 1 time have ttl looks don't need it.

"goal: run multiple processes handle events "pop them queue" ensuring treated once." - http://www.eaipatterns.com/competingconsumers.html simple solution, each worked have running should consume way: - getting message "queue", mark retrieved consumption , can in such state defined period of time. - consume. - alter status of message in queue , (re)move it.

have workers running in different vms , collect statistics each of them implementing http://arnon.me/soa-patterns/service-watchdog/

c++ qt distributed cqrs event-sourcing

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -