Skip to content

Conversation

@mjd507
Copy link
Contributor

@mjd507 mjd507 commented Jun 5, 2025

issues: #8467

issues: spring-projects#8467

Signed-off-by: Jiandong Ma <jiandong.ma.cn@gmail.com>
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

In general, it is very cool and smooth.
Just left a couple remarks, but I can address them on merge.
However I'd like to have a discussion since this is like the first time that someone else contribute this Java DSL API to Spring Integration, so other opinion really matters.

Thank you!


List<Integer> primeNumbers = (List<Integer>) payload;

assertThat(primeNumbers.size() == 4).isTrue();
Copy link
Member

Choose a reason for hiding this comment

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

There is a hasSize(4) API in AssertJ.

assertThat(message).isNotNull();
Object payload = message.getPayload();
assertThat(payload).isInstanceOf(Map.class);
assertThat(((Map<?, ?>) payload).get("UPDATED")).isEqualTo(1);
Copy link
Member

Choose a reason for hiding this comment

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

There is containsEntry() API in AssertJ.

* @return the storedProcExecutor
* @see StoredProcExecutor#setProcedureParameters(List)
*/
public StoredProcExecutorConfigurer procedureParameters(List<ProcedureParameter> procedureParameters) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we have this as vararg to not make end-user to use that List.of()?
Or... We can have just procedureParameter(ProcedureParameter procedureParameter) API and explain in its JavaDocs that it is safe to call it several times for more params.

* @return the storedProcExecutor
* @see StoredProcExecutor#setReturningResultSetRowMappers(Map)
*/
public StoredProcExecutorConfigurer returningResultSetRowMappers(Map<String, RowMapper<?>> returningResultSetRowMappers) {
Copy link
Member

Choose a reason for hiding this comment

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

Same idea here:

returningResultSetRowMapper(String name, RowMapper<?> rowMapper)

Then we build map internally.
(Same for the mentioned procedureParameters list to be built internally).

My point is that Java DSL should be as smooth as possible without extra hops.

* @param configurer the configurer.
* @return the spec
*/
public JdbcStoredProcOutboundGatewaySpec configurerStoredProcExecutor(Consumer<StoredProcExecutorConfigurer> configurer) {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting idea, but this is not the style we follow in the project already.
I mean it feels like for the existing and familiar DSL API , it would be natural to have this as a dedicated StoredProcExecutorSpec and provide its factory method in that Jdbc main entry point.
But we can think about this callback as well.
I mean leave this configurerStoredProcExecutor method but have it like this instead:

configurerStoredProcExecutor(Consumer<StoredProcExecutorSpec> configurer)

So, then end-user would have a choice for their preferences: Use Jdbc.storedProcExecutor() factory or this configurer.

@mjd507
Copy link
Contributor Author

mjd507 commented Jun 5, 2025

sure, I ll leave it you.

Thank you

Message<?> message = this.inboundFlowPollerChannel.receive(10_000);
List<?> rows = (List<?>) message.getPayload();
assertThat(rows.size()).isEqualTo(2);
assertThat(rows.get(0) instanceof Inbound).isTrue();
Copy link
Contributor

Choose a reason for hiding this comment

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

This line can be updated to assertThat(rows.get(0)).isInstanceOf(Inbound.class);. There are other tests that you can use this same pattern

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

@mjd507 ,

please, let us know if you are going to address reviews, or you agreed with them and we can solve them ourselves on subsequent commits after merging your.

There is another part we have missed from our previous review cycle.
Docs. The whats-new.adoc deserves an entry for this new feature and target jdbc directory for docs has to have a new dsl.adoc file with explanation for this new API you have just introduced.

The package-info.java file also has to be places in this new jdbc.dsl package.

Thanks

@mjd507
Copy link
Contributor Author

mjd507 commented Jun 6, 2025

@artembilan Thanks for the feedback, kindly help me to merge or solve that, I will learn from your commits about Docs part as well!

Thank you!

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

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

OK. I'll take it from here then.

Thanks

@artembilan artembilan merged commit cd15675 into spring-projects:main Jun 6, 2025
3 checks passed
artembilan added a commit that referenced this pull request Jun 6, 2025
Follow up for: #10081

* Rename `StoredProcExecutorConfigurer` to `StoredProcExecutorSpec`
* Add `Jdbc.storedProcExecutorSpec()` factory
* Improve logic of `StoredProcExecutor`-based Java DSL classes to handle an external `StoredProcExecutor` as well
* Add `package-info.java` into the `jdbc/dsl` package
* Add `/jdbc/dsl.adoc` and respective `What's New` entry
@artembilan
Copy link
Member

@mjd507 ,

So your change has been merged as is.
However I have done some improvements and promised docs.
Here is follow up commit: b8116d5.
I'd appreciate if you take a look over there and give any feedback.

Thank you for your great contribution; looking forward for more!

@mjd507
Copy link
Contributor Author

mjd507 commented Jun 6, 2025

Looks very good to me.

Thank you!

@mjd507 mjd507 deleted the jdbc-dsl branch June 10, 2025 09:18
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.

3 participants