Consuming apis with webclient - spring-webclient

please help me how to create web client
My requirement is to develop middle ware services to consume existing APIs and database is postgres now my confusion is how to get data from postgres through consuming APIs and store the data to couchbase server that is my question

Related

How to check if a Client is connected to my spring boot backed server or disconnected?

I am new to Spring boot. I am currently working on a Poker app (android) and decided to use Spring Boot as Backend. Using HTTP requests and responses to handle client, I am facing difficulty when it comes to client's connectivity. cause I need to know if a player is connected to game table or not. Can I use WebSockets to resolve this or I need to use TCP support?
Any advice is be appreciated and please help me here providing some useful resources.
Thanks

Using Spring Cloud Data Flow with Azure Service Bus

I am trying to find some examples of Spring Cloud Data Flow and Azure Service Bus setup. .
I have found https://github.com/microsoft/spring-cloud-azure/tree/master/spring-cloud-azure-stream-binder/spring-cloud-azure-servicebus-topic-stream-binder but it is still in RC and I do not see any examples (which cover Spring Cloud Data Flow) there.
Could you please help me to understand if I can use Spring Cloud Data Flow and Azure Service Bus together?
I was able to run examples with Kafka and RabbitMQ, but I cannot find anything about Azure Service Bus that can be used as the integration solution for Spring Cloud Data Flow
Spring Cloud Data Flow doesn't necessarily need to know what messaging layer you choose to run your applications on. Hence, your question is more likely related to how one can run the application with Azure Service Bus using Spring Cloud Stream.
This is one such a sample: https://learn.microsoft.com/en-us/java/azure/spring-framework/configure-spring-cloud-stream-binder-java-app-azure-event-hub?view=azure-java-stable
Once the application is built using Spring Cloud Stream (using the Azure event hub binder), you can then manage these applications using Spring Cloud Data Flow as Streaming applications.

Where to manage session in microservices architecture with Spring Boot

I am fairly new in microservices architecture. I've been trying to build a microservices stack using Spring Boot, Spring Cloud and Netflix OSS libraries.
I want to know what is the correct way and place to store session.
Here is an overview of the infrastructure that I created:
OAuth2 backed Authorization/Authentication Server
UI Service (Spring Boot, Front end service)
Backend Service-1
Backend Service-2
Redis Server to store session and other cachable data
Discovery Server (eureka)
Currently, I'm trying to store session in Redis by configuring UI service to perform it. It seems to be working fine, although I haven't had the chance to try it for multiple service instances. However, I'm already having serialization/deserialization issues while developing.
By the way, trying to store the session on front end app is the correct place to do or it should be done in Authorization/Authentication service as authentication is processed in that service?
Here is my Session config in UI service (front end service)
#Configuration
#EnableRedisHttpSession
public class SessionConfig extends
AbstractHttpSessionApplicationInitializer {
public SessionConfig() {
super(RedisConfig.class);
}
}
To sum up, I'm expecting to achieve and use best practices on this project. Your kind assistance would be appreciated.
The idea of a general server side user session and a microservices style architecture don't go together well. The reason being that you are likely to break the separation of concern that you use separate the domain boundaries of your services.
Remember, every service is supposed to service a specific domain problem autonomously - including all required data persistence. So for example if there is anything to remember for a users connected devices you would do that in the one service that is responsible for those device connections and nowhere else. The service would be responsible for processing those request and persisting any status that the devices require. Similarly when there is anything to remember about he users authorization you would do that in the authorization service.
And regarding the question to use Redis or not - In a microservices architecture the choice of storage system would be up to the service architect. Maybe one service stores its data in a relational database, maybe another uses a key-value-store and yet another may use an event queue system or a time series database.
So in summary you have to ask yourself what your session really is used for and make the corresponding services responsible to persist that information in a domain specific way. (If you give some more details in your question about this, I can give you my opinion).

Is there a JDBC driver which wraps a WSO2 Data Service?

I use OGSA-DAI as a middleware for data integration. The problem is that OGSA-DAI works with RDF, XML, Relational and Flat File Data Resources. However, in one case data are provided through a "local" middleware, i.e. as WSO2 Data Services.
My question is whether there is an implementation of a JDBC driver as a wrapper of a WSO2 Data Service.
No, there is no such thing as a JDBC driver wrapping a data service. Basically a data service is a typical SOAP web service, or a REST service. And for SOAP web services, you will get a WSDL, which can be used to code generate stubs, and these stubs can be used to call the target data service. So it will not make sense to map these web service operations into a JDBC driver.
Cheers,
Anjana.

When to use WCF and when to use ADO data services in ajax websites?

I am really confused about when to use WCF and when to use ADO data services in my website ajax calls.
I always make my javascript code call a webservice to get data from server "ajax".
But while reading in both WCF and ADO data service, i am not sure when to use each and when not use?, and if they replace each other in my case? or can live side by side?
Can anyone make me understand in points when to use which in ajax websites?
ADO.net Data Services is a library to expose a datasource thru Wcf.
As such the functionality exposed by an Ado.net Data Service is for reading, updating, creating and deleting records in that DataSource.
With Wcf you can expose any kind of functionality (that's why an ADO.net Data Service is a WCF service)
So to answer your question, if your client application needs direct access to the datasource then Ado.net Data Services will provide that functionality out of the box.
If the client needs to talk to a Business Layer which in turn will access that Data Access Layer then you will expose that Business Layer as Wcf Services.
You could well use both approaches in the same application:
Exposing some tables directly using ADO.net Data Services
Exposing Business Logic with a WCF service
In a banking application for example you would not expose the Account table because you want to enforce some business rules.
In a simple ToDo list application you could expose the Tasks table using ADO.net data services because there is no business logic to be applied (note that I said SIMPLE ToDo list app)

Resources