Skip to content

Plugins refactor#306

Merged
yschimke merged 6 commits into
rsocket:1.0.xfrom
yschimke:plugins2
Jun 15, 2017
Merged

Plugins refactor#306
yschimke merged 6 commits into
rsocket:1.0.xfrom
yschimke:plugins2

Conversation

@yschimke

@yschimke yschimke commented Jun 11, 2017

Copy link
Copy Markdown
Member

RFC, still hacking on this.

  • Allow per client/server plugins
  • move fragmentation to the existing MTU on factories
  • default to existing global plugins

}

public void addConnectionPlugin(DuplexConnectionInterceptor interceptor) {
connections.add(interceptor);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It doesn't look like differentiating between different server/clients but applies the same interceptor list to all server and clients..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If you have 1 client, 1 server, then you have 3 plugin registries.

  • JVM defaults via Plugins
  • RSocketFactory.receive() holds one
  • RSocketFactory.connect() holds one

So I think that counts.

@@ -0,0 +1,24 @@
package io.rsocket.plugins;

/** JVM wide plugins for RSocket */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you have a TODO to don't make this JVM wide?

@yschimke yschimke Jun 12, 2017

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's part of this PR, you can add interceptors to the RSocketFactory. But I got the impression that it may be a useful feature to apply some plugins at app startup for all clients. I'm not against that being used judiciously.

So no TODO, this was deliberate. n.b. I folded the one existing JVM wide plugin (fragmentation) in via being the default MTU for clients/servers.

@@ -90,6 +93,8 @@ public void startup() {

server =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about creating two+ servers and two+ clients and being able to use different interceptors for them?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll test that via more specific tests, e.g. a unit test of the builders that shows the right interceptors are applied. I think Integration tests are better left for testing end to end scenarios.


static {
if (Boolean.getBoolean("io.rsocket.fragmentation.enable")) {
int mtu = Integer.getInteger("io.rsocket.fragmentation.mtu", 1024);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is removed as its already supported in the Builder, so I can move this system property logic to become the default MTU.

If I leave it here, you get fragmentation twice if user overrides.

@yschimke

Copy link
Copy Markdown
Member Author

@phoad do you want to see if this works for you now? Let me know and if so I'll merge in.

@phoad

phoad commented Jun 15, 2017

Copy link
Copy Markdown
Member

I have re-reviewed the update and it seems good to me.

@yschimke yschimke merged commit f03f832 into rsocket:1.0.x Jun 15, 2017
@yschimke yschimke deleted the plugins2 branch June 16, 2017 19:41
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.

2 participants