-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
Add an option to start the containers after the ApplicationContext is refreshed #723
Comments
Hey @jacobmarshmallow, thanks for bringing this up. Did this work with Spring Cloud AWS 2.x? Just FYI, in Spring Cloud AWS 3.0 containers created via
That would actually be helpful, thanks. |
I'm not actually sure if it worked with 2.x (and happy for it to be a feature request / noted in the docs).
That's good to know, I think in this case it's just one listener being set up and it takes over 10s to make the first connection (to get the queue URL) so we were able to inject that directly as a property. We also tried the CRT client for faster start times but it didn't work either (and is still pre v1). Here is a replication using test containers, but it was originally discovered in ECS. |
Yeah, at this point I'm prioritizing missing features from the previous version getting in the way of people migrating to 3.0. But I should get to it in time for 3.0 nevertheless.
Is the SQS startup still slow after you feed it the queue URL? And why does it take 10s to get the queue URL, is this expected?
Thanks, I'll take a look. It seems though you're mixing up Spring Cloud AWS versions in your <dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-sqs</artifactId>
</dependency>
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-starter-aws-messaging</artifactId>
<version>2.4.4</version>
</dependency> Would you mind replacing these for the Thanks |
No, it's fine now as it doesn't need to make any requests
I'm not sure but we have experienced slow first requests using dynamo before, 10 seconds to get a URL is quite excessive though.
Thanks, I've fixed it and updated it to use RC2 now 🙂. The problem of lazy listeners not getting initialized still persists |
I'm wondering how is it with Kafka, AMQP or other Spring modules. |
I'll try to take a look into this this weekend. |
@jacobmarshmallow the way What we can look into adding would be implementing How does this sound? |
Hey @tomazfernandes that sounds like a good compromise |
@jacobmarshmallow just curious - what’s the behavior you’d expect from using the listener beans as Lazy? |
@tomazfernandes it's a fair question, I was hoping that the listener bean would still be initialised and process SQS messages just that it wouldn't block the Tomcats start up. So that the REST requests can start being processed ASAP and the secondary functionality of processing the SQS messages would still occur but can be slower |
Hmm, that's an interesting proposition. I think we could have an option of registering the beans at startup with The downside would be that if an error occurs when spinning up the containers we would need to decide whether to stop the application or not, but either way the application would already be serving requests. I think we have two separate features here - implement auto startup, and then look into adding an option of starting the containers after the application is up. Would you like to open these issues? Thanks |
Hey @jacobmarshmallow, I wonder if you'd be interested in contributing a PR with this feature. Thanks. |
We now have |
Just chipping in so others with similar problems may find this issue. We have upgraded our application to Spring Boot 3.2.0 from Spring Boot 2.x recently and the At the end of the day, the issue is the same: We have the |
Type: Bug
Component:
SQS
Describe the bug
I'm unsure if this is intended but thought I'd raise it just in case. when using
spring.main.lazy-initialization=true
our listeners marked with@SqsListener
don't get registered unless marked with@Lazy(false)
. It's not a huge issue but SQS is one of the main reasons for slow service start times and isn't necessary immediately in this service.Versions:
Sample
I can provide a smallest possible reproduction if needed, but it was essentially an empty project with spring boot 3 web + cloud + messaging + sqs
The text was updated successfully, but these errors were encountered: