callBack() processing at lower rate than the topic messages ?

asked 2018-04-10 05:53:52 -0500

pan gravatar image

updated 2018-04-10 05:57:34 -0500

If callBack() can't process the coming messages on time, what is going to happen with the unprocessed message, Will the later one overwrite the former message? for example:

 void callBack(int a){
        for(int i=0; i<a; i++){
            Do some time consuming work...

if topic message sequence is a=100, 2, ... coming at high rate. at first message, a will equal to 100, when message "2" come while callBack() still in for() loop, how about the value of "a", 2 or 100?

edit retag flag offensive close merge delete


Why don't you simply try it?

NEngelhard gravatar imageNEngelhard ( 2018-04-10 07:38:40 -0500 )edit

any suggestion on how to test it?

pan gravatar imagepan ( 2018-04-11 02:27:09 -0500 )edit

Simply print the value of a for some time...

NEngelhard gravatar imageNEngelhard ( 2018-04-11 05:35:09 -0500 )edit

each subscriber has Buffer and keep unprocessed msg in Buffer .if Buffer over flow the old msg ignored

hamid gravatar imagehamid ( 2018-04-11 08:12:53 -0500 )edit

yes, that's right. I got its detail at and it is just like what hamid said.

pan gravatar imagepan ( 2018-04-12 20:51:33 -0500 )edit