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

[api-draft][connector] Add simplified connector api #2041

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

ashulin
Copy link
Member

@ashulin ashulin commented Jun 21, 2022

Purpose of this pull request

Add simplified connector api

Check list

@ashulin ashulin force-pushed the simple-connector branch 7 times, most recently from bbbb11f to 1e5602e Compare June 22, 2022 14:04
Copy link
Member

@EricJoy2048 EricJoy2048 left a comment

Choose a reason for hiding this comment

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

@Hisoka-X
Copy link
Member

Hi, please resolve conflict

@Hisoka-X Hisoka-X merged commit a7357b6 into apache:api-draft Jun 27, 2022
lhyundeadsoul pushed a commit to lhyundeadsoul/incubator-seatunnel that referenced this pull request Jun 28, 2022
lhyundeadsoul pushed a commit to lhyundeadsoul/incubator-seatunnel that referenced this pull request Jun 28, 2022

public class FakeSourceSplit implements SourceSplit {
public class SingleSplitReaderContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why doesn't org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext extend SourceReader.Context rather than composition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Using composition prevents developers from using the SourceReader.Context#sendSplitRequest and SourceReader.Context#sendSourceEventToCoordinator methods. If we use implements, we need to throw exceptions in this methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a little unintelligible that SingleSplitReaderContext is NOT a subclass of SourceReader.Context , How about following alternatives:

  1. SingleSplitReaderContext implements SourceReader.Context, and remove sendSplitRequest sendSourceEventToCoordinator from SourceReader.Context if possible. I think these method may not belong Context Object.
  2. Use implements, and throw exceptions. That also makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

The instantiation of SourceReader.Context is hidden, so although SingleSplitReaderContext can implements SourceReader.Context, it must be combined with the internal SourceReader.Context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I still don't understand why ParallelReaderContext can implement SourceReader.Context but SingleSplitReaderContext can not?

Copy link
Member Author

@ashulin ashulin Jul 6, 2022

Choose a reason for hiding this comment

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

ParallelReaderContext belongs to the translation module, and the translation module can define how to translate the api to the source of the engine (that is, how the reader and the enumerator interact is determined by the engine, etc.);
SingleSplitReaderContext belongs to the connector module, and it cannot define how the Context actually works.

Copy link
Contributor

Choose a reason for hiding this comment

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

ParallelReaderContext belongs to the translation module, and the translation module can define how to translate the api to the source of the engine (that is, how the reader and the enumerator interact is determined by the engine, etc.);

SingleSplitReaderContext belongs to the connector module, and it cannot define how the Context actually works.

Thx for your explanation. I can better understand translation module

@@ -24,12 +24,7 @@
*/
public interface SeaTunnelRuntimeEnvironment {
Copy link
Contributor

Choose a reason for hiding this comment

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

xxxAware is a better class name when there is only onesetXXXmethod.
Refer to spring framewok org.springframework.web.context.ServletConfigAware ``org.springframework.context.ApplicationContextAware

Copy link
Member Author

Choose a reason for hiding this comment

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

This's good idea! Can you contribute to it?

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem

@ashulin ashulin deleted the simple-connector branch July 15, 2022 02:09
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.

4 participants