Interface BatchAwareBackPressureHandler
- All Superinterfaces:
BackPressureHandler
- All Known Implementing Classes:
CompositeBackPressureHandler,ConcurrencyLimiterBlockingBackPressureHandler,FullBatchBackPressureHandler,SemaphoreBackPressureHandler
BackPressureHandler specialization that allows requesting batches.- Since:
- 3.0
- Author:
- Tomaz Fernandes, Loïc Rouchon
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.awspring.cloud.sqs.listener.backpressure.BackPressureHandler
BackPressureHandler.ReleaseReason -
Method Summary
Modifier and TypeMethodDescriptiondefault intDeprecated.This method is deprecated and will not be used by the Spring Cloud AWS SQS listener anymore.default voidrelease(int amount, BackPressureHandler.ReleaseReason reason) Releases the specified amount of permits for processed messages.default voidDeprecated.This method is deprecated and will not be called by the Spring Cloud AWS SQS listener anymore.intRequest a batch of permits.Methods inherited from interface io.awspring.cloud.sqs.listener.backpressure.BackPressureHandler
drain, release, request
-
Method Details
-
requestBatch
Request a batch of permits.- Returns:
- the number of permits acquired.
- Throws:
InterruptedException- if the Thread is interrupted while waiting for permits.
-
releaseBatch
Deprecated.This method is deprecated and will not be called by the Spring Cloud AWS SQS listener anymore. ImplementBackPressureHandler.release(int, ReleaseReason)instead.Release a batch of permits. This has the semantics of letting theBackPressureHandlerknow that all permits from a batch are being released, in opposition toBackPressureHandler.release(int)in which any number of permits can be specified. -
release
Description copied from interface:BackPressureHandlerReleases the specified amount of permits for processed messages. Each message that has been processed should release one permit, whether processing was successful or not.This method can be called in the following use cases:
BackPressureHandler.ReleaseReason.LIMITED: all/some permits were not used because another BackPressureHandler has a lower permits limit and the difference in permits needs to be returned.BackPressureHandler.ReleaseReason.NONE_FETCHED: none of the permits were actually used because no messages were retrieved from SQS. Permits need to be returned.BackPressureHandler.ReleaseReason.PARTIAL_FETCH: some of the permits were used (some messages were retrieved from SQS). The unused ones need to be returned. The amount to be returned might be 0, in which case it means all the permits will be used as the same number of messages were fetched from SQS.BackPressureHandler.ReleaseReason.PROCESSED: a message processing finished, successfully or not.
- Specified by:
releasein interfaceBackPressureHandler- Parameters:
amount- the amount of permits to release.reason- the reason why the permits were released.
-
getBatchSize
Deprecated.This method is deprecated and will not be used by the Spring Cloud AWS SQS listener anymore.Return the configured batch size for this handler.- Returns:
- the batch size.
-