I'm using Spray for exposing a set of RESTful services. In one of the service, I have to make a call to another REST end point. For this purpose, I'm using Play framework's WSClient (from the play.api.libs.ws.{WS, WSClient}). I can see from my logs that when I use Play's WSClient, I get another ActorSystem initialised. Two questions:
How could I make use of the underlying Spray's Actor System (the one that I create when I start my application)
Is there a Spray library that I could use instead of Play's?
Related
I would like to get some clarity on terminology of microservices.
Reference to the diagram mentioned below.
All Represents the Microservice Architecture
Microservice - Does it refer the service which are exposed as API to channel [ Be it browser / Native app / Host ] or even the service which not exposed [ Underlying
Generic
Orchestrated
Atomic
As per the diagram, Links from orchestrated to atomic were mentioned.
Does it have to be always a [REST/ HTTP over call] or is it can be normal Java library method call packaged in the same runnable package.
All tutorials says / goes 1 Microservice = 1 Rest based service or anything exposed as controller to be called from
Can we call library or DAO Generic Service also a microservice?
Microservice Architecture ViewPoint
Microservice ViewPoint 2
Comparison
Does it refer the service which are exposed as API to channel or even the service which not exposed
A microservice is a service that serve a business need - they are "Componentization via Services" - componentes of a bigger system, so they don't necessary need to be exposed to external world, but they can be.
Does it have to be always a REST/ HTTP over call, or is it can be normal Java library method call packaged in the same runnable package.
Microservices communicate over network, but it does not have to be HTTP / REST, it can also be a Kafka topic or gRPC or something else. The important part is that they must be independently deployable e.g. you can upgrade a single microservice without needing to change another service at the same time.
See Martin Fowler - Microservices - 9 characteristics for the most commonly accepted definition.
I know there is a way (setting the port to 0) to create multiple instances of a microservice dynamically.
My requirement is, I have a set of multiple clients and each client will have its corresponding business logic implemented its corresponding implementation class.
I have a factory method design pattern to return me the corresponding implementation class based on the client ID I pass to the factory method.
I want to deploy it as a microservice for one client. For the remaining clients, the microservice should be instantiated dynamically for each client ID and its corresponding implementation class should process its business logic based on the client ID passed to the factory method.
Is it possible technically using spring cloud?
If your service already has the business logic implemented for every client, I don't quite understand why you would want to instantiate another micro service for every client. The one service already deployed should work if you can manage to send in the client ids.
If the deployment is on client's servers, it's not a good idea to have all the clients' business logic code in one service.
I am a newbie in reactive programming. I did some research but could not find any satisfactory answer. My requirement is to correlate request and response using reactive programming (using spring boot) in a asynchronous set up.
In detail - My organization application architecture has front end, middleware and legacy backend. Front end makes a call to middleware which talks to legacy backend over MQ. At the moment call to backend is synchronous over MQ. We are trying to uplift the experience by making the backend call asynchronous. So in this setup front end will make a call over http/rest to middleware which puts the message over MQ to be consumed by legacy systems. Once legacy system is done with processing, it will put the message back on to another queue which will in turn be picked up by middleware again and send back to front end systems. In this set up my job is to correlate the request/response in the middle layer. We have one option to use DB but I want to see whether it is possible to use reactive java for the same.
Any help in this regard would be appreciated.
When using the an instance of the DataServiceContext class to materialise objects from an odata endpoint where the endpoint exposes some custom annotations, how does one get hold of the annotations data. I can't see any obvious extensibility points.
Custom annotations aren't exposed as a first-class concept on the DataServiceContext, but you can access them by hooking into the client response processing pipeline. This code will run after every entity is finished being read:
context.Configurations.ResponsePipeline.OnEntryEnded(
entryArgs => DoSomething(entryArgs.Entry.InstanceAnnotations));
Internally, the WCF Data Services Client uses a lower-level library called ODataLib (aka Microsoft.Data.OData on NuGet). The response and request pipelines allow you to dip into that lower level to get extra information when you need it, but you still get all the conveniences of using the full-fledged WCF Data Services client library. The classes like ODataEntry, ODataFeed, etc. that you work with on the processing pipelines are all part of the ODataLib API.
My application is written in Spring Framework 3.x.x. In my application I want to integrate the JBPM5.x processes using its REST API. I have done this thing but I want to send feedback like simple message to my spring application so that I'm able to know what will be the status of my process on the exit of the process. I'm not able to find any way to send this kind of feedback using REST API.
Please give the right direction for it, or give any other way to integrate Spring and JBPM so that my Spring application and JBPM process can be run in different application container instances (same application server but two different instances).
Not sure the REST api would be capable of handling something like that, it is basically some stateless API to get / send information, but doesn't handle async notifications.
What I would recommend is registering a custom process listener to the engine that will be notified when a process is completed, at that point you can do whatever you want, like for example send a JMS message or any other type of async message that could be picked up by your application.
This information is probably already stored in the history log as well. So if your Spring application could take advantage of that, that might be an option as well.