Read and Write datasources in one spring boot app - java

I want to have read and write datasources for replication purposes in spring boot app. Are there any examples on how to implement this behavior?

This could help you
Spring Boot Configure and Use Two DataSources
also you could take a look on this blog

This is what I was looking for http://fedulov.website/2015/10/14/dynamic-datasource-routing-with-spring/

Related

How to connect Kafka to legacy Spring

I am working on PoC of connecting legacy Spring application to Kafka. It is war application to be deployed in Tomcat, Spring version 4.3.12. Is there some library to make communication with Kafka almost as easy as with Spring Boot? I need just fundamental operations: sending message, listening for confirmation, receiving.
I have some experience with Spring Boot support as is provided in org.springframework.kafka:spring-kafka library. I am not sure how to efficiently adopt Kafka for legacy Spring - I'm thinking of using Kafka Java client which looks promising but as I am used to working at Spring Boot abstraction level I don't have clue how much code should I supply myself.
Web search is not much helpful in this case since it tends to show Spring Boot-related solutions. Migration of legacy application is considered too, I just need to have some idea how difficult each way is.
kafka-clients is all you need (from Maven Central, not Confluent). You could go a step further and look into Log4j2 Kafka bridge, then property files for that.
If you want to externalize config into regular Java .properties file, you can, or you can pull values from environment variables, if you follow 12-factor principles.
But if you don't already have Spring Boot dependencies, then I do not think adding them is worth it for only Kafka.
Also, the Spring-Kafka documentation covers how to configure your app without Boot.

How to implement spring boot Redis multi tenancy?

I am facing issues while creating a Multitenant application using spring boot and Redis. I have used the same solution which is mentioned in How to implement multitenancy for Redis in spring boot. But it didn't work. Is there a different way to implement Redis multitenancy with Spring boot.
I found the solution by adding a check if the data source not available in the cache then pull from the required source and create a connection. Also changed calling afterPropertiesSet() explicitly which is mentioned in How to implement multitenancy for redis in spring boot

SSO in Spring Boot with Active Directory (Multi-tenant)

We have a Multi-Tenant Spring Boot application, and now we want to support SSO with Active Directory for one of the tenants. Am not able to find a suitable solution for this. Would be really helpful if I can get suggestions on how or any reference solution for this requirement.

Spring batch job state configured to alert with prometheus

We are using Spring batch framework for project. Can I configure prometheus (https://prometheus.io/docs/practices/alerting/#alerting) with my spring batch framework. In prometheus docs, I can see an example of Spring boot only. Any help regarding this is highly appreciated.
Spring Batch does not have Micrometer integration at this time. It's something we're evaluating for a future release. Feel free to open an issue if you are interested!

Integrate Apache Cassandra Logging with Spring Web Application

I've this requirement where I need to make use of Cassandra 2.0.x built-in Logging functionality within my spring web application.
Can somebody tell me what all steps do I need to follow to achieve the same?
Thanks in advance

Categories