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

Add Pulsar config props for startup policy #42180

Closed

Conversation

onobc
Copy link
Contributor

@onobc onobc commented Sep 8, 2024

This commit adds properties to configure the startup behavior for the Pulsar message containers that back the @PulsarListener, @ReactivePulsarListener, and @PulsarReader.

This is to support the recently added startup policy feature in Spring for Apache Pulsar.

This commit adds properties to configure the startup
behavior for the Pulsar message containers that back
the `@PulsarListener`, `@ReactivePulsarListener`, and
`@PulsarReader`.
@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 9, 2024
@mhalbritter mhalbritter added this to the 3.4.x milestone Sep 9, 2024
@snicoll snicoll self-assigned this Sep 9, 2024
Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I've added some nit and I would have processed them myself but I'd like some confirmation about the default values and, potentially, a code change in Spring Pulsar to avoid code duplication.

Also, can you please build locally before pushing?

public static class Startup {

/**
* The max time to wait for the container to start.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description of configuration properties do not start with the, a, etc. I suggest Time to wait for the container to start.

private Duration timeout;

/**
* The action to take when the container fails to start.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same. I suggest Action to take when the container fails to start.

/**
* The max time to wait for the container to start.
*/
private Duration timeout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a default for this property? If so I think we should use the opportunity to set the default so that it's documented, and very in a test that it's consistent in case it changes.

/**
* The action to take when the container fails to start.
*/
private FailurePolicy onFailure;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the previous behavior was to continue and log an exception. There's no default value here so it's hard to see if that's still the case. If that's the case, this field should have a default value that matches the default behavior.

customizeReaderStartupProperties(readerContainerProperties);
}

private void customizeReaderStartupProperties(PulsarReaderContainerProperties readerContainerProperties) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that this is the exact same code as customizeListenerStartupProperties? Since the feature is shared, isn't there a way to avoid the code duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code to de-duplicate was more complicated than having this in multiple places.

customizeListenerStartupProperties(containerProperties);
}

private void customizeListenerStartupProperties(ReactivePulsarContainerProperties<?> containerProperties) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Sep 9, 2024
@onobc
Copy link
Contributor Author

onobc commented Sep 9, 2024

Thanks for the review @snicoll. I think we can close this in favor of #42182 . I apologize for not marking this as such or closing it myself before you spent time reviewing (my bad).

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 9, 2024
@onobc
Copy link
Contributor Author

onobc commented Sep 9, 2024

Also, can you please build locally before pushing?

Yes, I saw the red builds. I was building locally (had already run tests w/in IDEA) but was not running checks as I was using ./gradlew build -x check to avoid testing everything. I now know that -x check does not run format or checkstyle checks (which makes sense because they are "checks"). I was just trying to avoid running all tests in all modules.

This ./gradlew build -x test -x intTest seems to work.

@onobc
Copy link
Contributor Author

onobc commented Sep 9, 2024

Closing in favor of #42182

@onobc onobc closed this Sep 9, 2024
@snicoll snicoll removed the status: feedback-provided Feedback has been provided label Sep 9, 2024
@snicoll snicoll removed this from the 3.4.x milestone Sep 9, 2024
@wilkinsona wilkinsona added the status: declined A suggestion or change that we don't feel we should currently apply label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants