Skip to content

Provide an RSocketMessageHandlerCustomizer to allow customizing of the RSocketMessageHandler #20303

Closed
@joshlong

Description

@joshlong

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

If you have contributed before, consider leaving this one for someone new, and looking through our general ideal-for-contribution issues. Thanks!

Background

Spring Boot provides a number of callback interfaces that can be used to customize the beans that it auto-configures. For example, a TomcatConnectorCustomizer can be used to customize a Tomcat Connector.

Problem

At the moment, the only way to add customizations to a RSocketMessageHandler is to provide your own RSocketMessageHandler bean which completely overrides the auto-configured RSocketMessageHandler bean. This can be bit tedious and we should allow providing customizers instead which can be applied to the bean created by Spring Boot.

It would look something like:

@Bean
public RSocketMessageHandlerCustomizer messageHandlerCustomizer() {
	return (handler) -> handler.setRouteMatcher(...);
}

Solution

Add a RSocketMessageHandlerCustomizer type. Beans of RSocketMessageHandlerCustomizer type should be applied automatically to RSocketMessageHandler, this can be done here.

The ObjectProvider interface can be used for injecting a dependency. Here is an example that can be used to inject customizers when there can be 0..n of them.

Tests are here.

Steps to Fix

  • Claim this issue with a comment below and ask any clarifying questions you need
  • Set up a repository locally following the Contributing Guidelines
  • Try to fix the issue following the steps above
  • Commit your changes and start a pull request.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions