Skip to content
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

Receive Messages Serially #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eccles
Copy link
Contributor

@eccles eccles commented Apr 17, 2024

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

@eccles eccles requested review from wp0pw and j-hartley April 17, 2024 09:51
azbus/receiver.go Outdated Show resolved Hide resolved
@eccles eccles force-pushed the dev/paul/9378-serial-and-session-hanling branch from 532b35f to 7243ce6 Compare April 18, 2024 08:18
@eccles eccles changed the title Serial and session Receive Messages Serially Apr 18, 2024
@eccles eccles requested a review from henry739 April 18, 2024 08:22
@eccles eccles force-pushed the dev/paul/9378-serial-and-session-hanling branch 4 times, most recently from 3a8d8f1 to bac9292 Compare June 18, 2024 10:08
@eccles eccles force-pushed the dev/paul/9378-serial-and-session-hanling branch from bac9292 to 8ba2a73 Compare June 18, 2024 10:27
// 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)
Copy link
Collaborator

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

if err != nil {
return fmt.Errorf("failed to open handler: %w", err)
}
}
Copy link
Contributor

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?

@eccles eccles force-pushed the dev/paul/9378-serial-and-session-hanling branch 2 times, most recently from 4886399 to 6e077a0 Compare June 28, 2024 07:54
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
@eccles eccles force-pushed the dev/paul/9378-serial-and-session-hanling branch from 6e077a0 to 9fc974c Compare July 16, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants