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

Need to bind multiple rabbitmq and/or mysql services to JVM #87

Closed
MrMarkW opened this issue Mar 4, 2020 · 7 comments
Closed

Need to bind multiple rabbitmq and/or mysql services to JVM #87

MrMarkW opened this issue Mar 4, 2020 · 7 comments

Comments

@MrMarkW
Copy link

MrMarkW commented Mar 4, 2020

I'm in PCF using SCS 3.1 with the following dependencies:

  • io.pivotal.spring.cloud:spring-cloud-services-starter-config-client:3.1.1.RELEASE
    • io.pivotal.cfenv:java-cfenv-boot-pivotal-scs:2.1.1.RELEASE
      • io.pivotal.cfenv:java-cfenv-boot:2.1.1.RELEASE

CfEnvironmentPostProcessor doesn't allow multiple Rabbitmq service instances to be bound to a single application.

I'm looking for a way to override or disable CfEnvironmentPostProcessor for our rabbitmq and mysql bindings since we need to support multiple rabbitmq clusters and mysql instances in a single JVM. I would be fine adding my own custom PostProcessor to handle these situations, but I haven't seen a clear example of how to override or disable what is set in the META-INF/spring.factories

Is the better option to use try spring-cloud/spring-cloud-connectors 2.x instead? We are new to the PCF and would prefer to build upon the new models.

Any help would be much appreciated!

@dyroberts
Copy link
Contributor

dyroberts commented Mar 6, 2020

Hi @maximusfloydus. As a workaround, I would suggest excluding the io.pivotal.cfenv:java-cfenv-boot dependency and adding a dependency on the more flexible base library io.pivotal.cfenv:java-cfenv-jdbc. Once this is done, you can follow the docs here to connect as many services as you need of each type. If you go this route, you'll also need to configure the scs properties in this manner as well. You can find them here for config-client and here for eureka-client.

@dyroberts
Copy link
Contributor

The other option is, as you mentioned, to use the 2.x line of scs starters. But, as you've noticed, they use spring-cloud-connectors; which I don't believe will reduce the complexity for you.

@dyroberts dyroberts added refine enhancement New feature or request labels Mar 6, 2020
@MrMarkW
Copy link
Author

MrMarkW commented Mar 15, 2020

By excluding io.pivotal.cfenv:java-cfenv-boot I lose access to two import classes: io.pivotal.cfenv.spring.boot.CfEnvProcessor and `io.pivotal.cfenv.spring.boot.CfEnvProcessorProperties...

@dyroberts
Copy link
Contributor

The CfEnvProcessor is the main abstraction of the boot module. Since you're not going to use the boot module, you won't be writing any CfEnvProcessors! You'll just follow the docs here to set application properties with SpEL and the CfJdbcEnv bean. See my comment above for details on the particular properties that need setting for scs.

@dyroberts dyroberts removed enhancement New feature or request refine labels Mar 18, 2020
@dyroberts
Copy link
Contributor

After some thought, I think the approach suggested above is the best one for supporting multiple services of the same type.

@MrMarkW
Copy link
Author

MrMarkW commented Mar 30, 2020

@dyroberts Can SpEL be used in Spring Cloud Configuration or only in a local properties file?

It would be ideal if pivotal/vmware provide a little more flexibility in this library. I really would like to use this library for SCS Config, SCS registry, SSO and maybe a few other things. I just can't use it for JDBC or AMPQ in my current applications. I saw a PR to support a "enabled" flag #40. Another option would be allow the PostProcessor to not exit when it finds multiple, but just log the error and process the rest. I could do a PR also, if there is a path you guys would be willing to accept.

@dyroberts dyroberts reopened this Apr 1, 2020
@dyroberts
Copy link
Contributor

Thanks for your persistence @maximusfloydus. I've merged the Is enabled PR and released java-cfenv v2.1.2.RELEASE.

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

No branches or pull requests

2 participants