-
Notifications
You must be signed in to change notification settings - Fork 0
Receive Messages Serially #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
532b35f
to
7243ce6
Compare
3a8d8f1
to
bac9292
Compare
bac9292
to
8ba2a73
Compare
// we need a timeout per message if RenewMessageLock is disabled | ||
renewCtx, renewCancel, maxDuration = r.setTimeout(ctx, r.log, msg) | ||
defer renewCancel() | ||
r.processMessage(renewCtx, i+1, maxDuration, msg, r.serialHandler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for the forestrie use case. The handling of the whole batch needs to be in the application handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Handler recives a slice of messages which it can process as it sees fit so the logic is in the application handler surely...
if err != nil { | ||
return fmt.Errorf("failed to open handler: %w", err) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return nil in this if statement at the end and get rid of the else?
4886399
to
6e077a0
Compare
New functional option to add a serialHandler that reads N messages at once and process them one at a time - serially. receiver := NewReceiver(, WithSerialHandler(h, 200)) where h is an instance of Handler. Defining a SerialHandler this way disables the normal parallel processing defined by WithHandlers(). It is highly recommended to specify RenewMessageLock if the number of received messages is high (say > 10). One has to be sure that processing the number of messages within 60s is achievable. AB#9378
6e077a0
to
9fc974c
Compare
New functional option to add a serialHandler that reads N messages at
once and process them one at a time - serially.
where h is an instance of Handler.
Defining a SerialHandler this way disables the normal parallel
processing defined by WithHandlers().
It is highly recommended to specify RenewMessageLock if the number of
received messages is high (say > 10). One has to be sure that processing
the number of messages within 60s is achievable.
AB#9378