Releases: JaidenAshmore/java-dynamic-sqs-listener
Releases · JaidenAshmore/java-dynamic-sqs-listener
3.0.0 Milestone 3
This milestone contained big changes to the frameworks API to follow a non-blocking paradigm. This reduces the number of threads that are blocked while there are no messages to process. For example, if we have 2 listeners with concurrency of 30 threads each and there are no messages to process, there would be 60 threads blocked. With this approach only the threads that are being used to process messages will be around.
This also changed how the framework is shutdown by allowing for any messages that have been download and stored locally will have a chance to be processed before the application ends.
API Redesign
- The MessageBroker has been redesigned to not need to have a background thread running to process messages. Instead it exposes methods to process methods where the container can provide how messages are retrieved and resolved.\
- The MessageResolver got merged with the Async version because attempting to do graceful shutdowns where all messages are resolved before finishing don't work when there is no way to wait for the resolver to finish. In other words all reliable MessageResolvers needed to be Async.
- The MessageRetriever has been made non blocking my returning a
CompletableFuture
for the message instead of blocking and returning the message when it is obtained. It has also been merged with the Async implementation as a non-async implementation doesn't work well with graceful shutdowns. When the retriever is shutdown it will also return any messages that have been stored internally so that they can be processed on shutdown if desired. - The MessageProcessor now returns a
CompletableFuture
for when the message has finished processing. It now also takes in aRunnable
that should be called if the message has successfully been processed and should been resolved instead of requiring a dependency on the MessageResolver. - The MessageListenerContainer previously had the responsibility to start and stop the background which it could do all at once by stopping the
ExecutorService
. Now it has been made to have more responsibility with determining the order of startup and shutdown to allow for more graceful shutdowns. For example, it now has the responsibility of allowing the processing of any messages downloaded but not processed yet.
Core Changes
- SimpleMessageListenerContainer was changed to CoreMessageListenerContainer as it isn't very simple anymore. It now handles gracefully shutting down the container so that any extra messages, e.g. messages prefetched, can be processed before shutting down.
RetryableMessageProcessor
was removed. I don't want to maintain this and it is simple for consumers to implement this them self if they want.BlockingMessageRetriever
was removed. This was provided to allow for more graceful shutdowns as well as for testing. This isn't really needed anymore.IndividualMessageRetriever
was removed. This was originally used to show that you could just request a message when needed but I feel it wouldn't be used in production and therefore is a waste for me to maintain it. You can achieve the same by using a BatchingMessageRetriever with a batch size of 1.
Spring Changes
- Core annotations updated to allow for the consumer to configure whether any messages downloaded but not processed should be processed on shutdown.
- Core annotations updated to allow for the consumer to configure whether any messages currently being processed during a shutdown should be interrupted.
3.0.0 Milestone 2
Enhancements
- [GH-128] IndividualMessageRetriver was improved to better handle errors and fixed some bugs. 1d04f22
- [GH-129] Significantly changed the names of properties, classes and logging of the library to be provide better consistency. Through this certain bugs were fixed as they were found (no issues for these). ca62f66
- ConcurrentMessageBroker
- Added the ability to configure the ConcurrentMessageBroker shutdown timeout period ConcurrentMessageBrokerProperties#getShutdownTimeoutInSeconds
- Added the ability to interrupt threads processing messages during the shutdown phase, in case they don't want to wait for it to be completed. ConcurrentMessageBrokerProperties#shouldInterruptThreadsProcessingMessagesOnShutdown
- Fixed a bug where shutting down the ConcurrentMessageBroker would always be interrupted when awaiting shutdown
- Improved the logging levels
- SimpleMessageListenerContainer
- Now waits for all async components to start before considering it started up
- Can now configure the shutdown time period and retry limit (if one of the dependent components missed an interruption) via SimpleMessageListenerContainerProperties
- BatchingMessageResolver
- Improved the logging levels
- BatchingMessageRetriever
- Removed configurable wait time for SQS messages in favour of the SQS maximum.
- PrefetchingMessageRetriever
- Fixed a bug where the min desired prefetched messages was off by one
- Removed configurable wait time for SQS messages in favour of the SQS maximum
QueueContainerService
was renamed to MessageListenerContainerCoordinator as its only responsibility is coordinating starting and stopping of containers and "Service" is pretty generic.- Removed IdentifiableMessageListenerContainer in favour of having the MessageListenerContainer have an identifier as this improves log messaging for when a container starts and stops.
- Renamed
QueueWrapper
to MessageListenerContainerFactory as these are building these containers from beans. - Renamed
QueueResolverService
to QueueResolver because it only resolves queue URLs and doesn't need to be a generic "service"
- ConcurrentMessageBroker
Tech Debt
3.0.0 Milestone 1
Enhancements
- [GH-116]: Spring Queue Listeners can now be connected to queues across multiple AWS Accounts by providing multiple
SqsAsyncClients
. See Docs - How to Connect to Multiple AWS Accounts for a guide. b70b903 - [GH-109]: ArgumentResolvers are now calculated for each parameter of the method when it is first built instead of every time a message is processed. f4cb0ed
2.3.0
Enhancements
- [GH-114]: The Spring Starter was split into Spring Core and Spring Starter so that people can include the Spring code without it auto configuring via the Spring Factories. E.g. an example would be them providing their own annotation
@EnableSqs
which will enable the framework when it is used. 153d8c9
Bug fixes
- [GH-119]: Fixed a problem where the shutting down of the
MessageRetrievers
was not being followed when the thread was interrupted during the call to get more messages from theSqsAsyncClient
but before we wait on theCompletableFuture
. c5d2f5e - [GH-112]: Spring batching queue listeners now properly distinguish between concurrency and batch rate. For example, you want 30 messages to be completed concurrently but you only want messages to be downloaded in batches of 10. Previously a concurrency of 30 would try and download a batch of 30. 346613a
Local Development Improvements
- [GH-111]: LocalSqsAsyncClient can now name the created DLQ instead of using the format
{queueName}-dlq
. 7a789f4
Tech Debt
2.2.0
Enhancments
- [GH-103]: Methods processing messages may now include the raw Message as an argument to the message when using the CoreArgumentResolver or by default in the Spring Starter. e88a0b5
public class MyListener {
@QueueListener("queueName")
public void myMethod(Message message) {
// do something with the raw message
}
}
- [GH-87]:Methods processing messages may now include individual MessageAttributes and MessageSystemAttributes as an argument to the message when using the CoreArgumentResolver or by default in the Spring Starter. 9d66dba, d0a78d2
public class MyListener {
@QueueListener("queueName")
public void myMethod(@MessageAttribute("key") String attribute) {
// do something
}
@QueueListener("otherQueueName")
public void myMethod(@MessageSystemAttribute(SENT_TIMESTAMP) String systemAttribute) {
// do something
}
}
- [QH-90]: Can now resolve annotation parameters using spring properties instead of having them hardcoded. f6bd8ff
@QueueListener(value = "something", concurrencyLevelString="$something.concurrencyLevel}")
and the application.yml has
something:
concurrencyLevel: 2
Bug Fixes
- [GH-97]: The code no longer has
catch (Throwable throwable)
for catching exceptions as this can catch Errors like anOutOfMemoryError
. 117036d - [GH-91]: Stop exceptions in the background threads of the application to cause the thread to stop. For example, if one of the Properties method throws a RuntimeException the whole background thread will stop. 67b555e, 442eb34