Skip to content

Allow in-process server and channel outside of test module #187

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

onobc
Copy link
Contributor

@onobc onobc commented May 26, 2025

This PR allows the usage of inprocess server and channel factories outside of tests.

Client side

  • Now auto-configures an InProcessGrpcChannelFactory as long as spring.grpc.client.inprocess.enabled is not set to false
  • Introduces a composite channel factory which combines all configured channel factories, including the in-process one
  • Each channel factory now has a supports method which is used by the composite to find a match

Server side

  • Now auto-configures an InProcessGrpcServerFactory if spring.grpc.server.inprocess.name is set

Test side

  • An inprocess channel and server factory that always use the same generated inprocess address are auto-configured as long as spring.grpc.test.inprocess.enabled is set to true
  • These inprocess channel and server factory override the ones from the client and server side above

TODO

  • fix failing samples
  • add docs

@onobc onobc marked this pull request as draft May 26, 2025 20:49
@onobc onobc force-pushed the GH-144-in-process-channels branch from 3921d92 to 344116f Compare June 2, 2025 01:21
@onobc onobc force-pushed the GH-144-in-process-channels branch from 344116f to cc8b17f Compare June 6, 2025 03:38
@onobc onobc marked this pull request as ready for review June 6, 2025 03:50
@onobc onobc changed the title WIP: Allow in-process server and channel outside of test module Allow in-process server and channel outside of test module Jun 6, 2025
}

/*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still need to update test this out and if it works improve this auto-config for the in process duplication

This commit allows the usage of inprocess server and channel factories
outside of tests.

Resolves spring-projects#144

Signed-off-by: Chris Bono <chris.bono@gmail.com>
@onobc onobc force-pushed the GH-144-in-process-channels branch from 5a302e4 to e76174d Compare June 7, 2025 19:03
- Fix @LocalGrpcPort to ignore the inprocess factory port
- Don't set load balancer policy for inprocess channel factory

Signed-off-by: Chris Bono <chris.bono@gmail.com>
@onobc onobc requested a review from dsyer June 7, 2025 19:48
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