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

[CDAP-21079] Refactor SPI/TMS for default context before spanner extension implementation #15731

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

Conversation

sidhdirenge
Copy link
Contributor

@sidhdirenge sidhdirenge commented Nov 11, 2024

As discussed offline about the directory structure

  • Moved extension loader, delegating messaging service to app-fabric/internal
  • Duplicated existing guice module for MessagingService in app-fabric/internal/guice. This will be used once spanner impl is ready instead of the cdap-tms/MessagingServiceModule.
  • Added MessagingContext and its default impl.
  • Added initialize() in MessagingService interface to initialize the MessagingContext based on cconf.

Tested by deploying docker image to GCP project.
All pods up and running.

@sidhdirenge sidhdirenge added the build Triggers github actions build label Nov 11, 2024
@sidhdirenge sidhdirenge changed the title Refactor SPI/TMS for default context before spanner extension implementation [CDAP-21079] Refactor SPI/TMS for default context before spanner extension implementation Nov 11, 2024
@sidhdirenge sidhdirenge marked this pull request as ready for review November 13, 2024 17:34
@@ -14,7 +14,7 @@
* the License.
*/

package io.cdap.cdap.messaging.client;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why moving it to app-fabric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention here is as follows:

  • We do not want to have dependency of (to be added) spanner extension on cdap-tms module.

  • Long term plan is to do away with the TMS pod itself. All the services will write to Spanner DB directly using the Spanner extension of messaging SPI.

  • Follow similar pattern to what data-fabric has currently : link

Please let us know what will be the best place to have this DelegatingMessagingService and the Default implementation of Messaging Context.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, with the new messaging SPI, we have to treat tms as one implementation of messaging SPI. So it's ideal to yank out and move specific implementations to somewhere else.
@chtyim if you think it's a bit risky and prefer to keep these in TMS, fine with me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on what Masoud mentioned above, essentially there should be:

  1. A cdap-tms module that defines the interfaces for other modules to interact with the tms. This module also defines the guice modules for loading the correct extension based on the configuration.
  2. A cdap-tms-spi module that defines the interfaces for the implementation of the tms storage layer
  3. Bunch of cdap-tms-ext-* modules for the implementations that implements interfaces defined in the cdap-tms-spi.

All other cdap modules should just have dependency on cdap-tms and use interfaces exposed from there.

@@ -130,6 +135,11 @@ private MessagingService getDelegate() {
"Unsupported messaging service implementation " + getName());
}
LOG.info("Messaging service {} is loaded", messagingService.getName());
try {
messagingService.initialize(new DefaultMessagingContext(this.cConf));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why move here instead of doing it in the regular initialize method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Messaging currently doesn't have initialize().
We need this to create spanner database clients. Extension is loaded at this particular place and the current object's delegate is set to the messagingService. So thought this would be an appropriate place for initialize().

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@@ -14,7 +14,7 @@
* the License.
*/

package io.cdap.cdap.messaging.client;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why moving to app-fabric?

Copy link

sonarcloud bot commented Nov 14, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
62.0% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Triggers github actions build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants