In the introduction page of spring cloud it is said that
Spring Cloud provides tools for developers to quickly build some of
the common patterns in distributed systems (e.g. configuration
management, service discovery, circuit breakers, intelligent routing,
micro-proxy, control bus, one-time tokens, global locks, leadership
election, distributed sessions, cluster state)
In terms of microservices and distributed systems, can someone explain what intelligent routing is ?
Intelligent routing in Spring Cloud refers to the Zuul project (see the Spring Cloud Netflix guide). It uses reverse proxies: when you define a resource location in your public API, Zuul basically re-routes calls to these locations to your microservices. In effect, you can hide the locations and compositions of your microservices without changing your API.
Related
I know about the 3 phase commit and SAGA pattern(doing transactions async in a distributed system using MQ). But it would involve using an MQ which makes me think of approach being taken mostly in SOA using ESB. Is there any way in which consistency can be achieved in between transactions in microservices using SpringCloud's inbuilt functionality.
I have read that, session is against the concept of RESTfulness.
Do sessions really violate RESTfulness?
Session Management in microservices
RESTful Authentication
Since Microservices inevitably use REST, does the same apply here as well? If so, then why do we have Spring session? It even lists 'Spring Session allows providing session ids in headers to work with RESTful APIs' as one of its features.
Apart from Scaling as an advantage of micro-services, it also provides you with the flexibility to choose polyglot architecture i.e (using the right programming language, framework, database for the right job).
If you use spring sessions(which off-course provides session replication across nodes), internally it uses Redis/gemfire/hazelcast as a replicated session store, but you will have to stick to one programming language & framework for all your services i.e Java & Spring resp.(You can off course write your own implementation in other languages to read from session store, but its re-inventing the wheels) And this will take away Benefit of Polyglot Architecture.
So typically in microservices architecture, you have a token-service(and it should be able to scale individually) implementation to generate tokens(aka sessionIds) which are used for Authentication & Authorization in each service and you should try to avoid storing the session information. It will also help to avoid "Single point of Failure".
I have two spring boot apps running in the same local network and they need to communicate with each other. An obvious answer is to leverage REST API and make http calls, but I would like to use Spring Integration project for this purpose.
That said, I have several architectural questions regarding that:
Should I setup a standalone messaging framework (e.g. Rabbit MQ) or embedded should also work (e.g. messaging will be embedded to one of the two apps).
If standalone, what messaging framework should I choose: ActiveMQ, RabbitMQ or something else?
Welcome to the Messaging Microservices world!
You go right way, but forget the embedded middleware if you are going to production. Especially when your application will be distributed geographically.
So, right you need some Message Broker and that should be definitely external one.
It's really your choice which one is better for your purpose. For example you can even take into account Apache Kafka or Redis.
If we talk here about Spring Integration it might be better for you to consider to use our new product - Spring Cloud Stream.
With that you just have your applications as Spring Boot Microservices which are able to connect to the external middleware transparently for the application. You just deal with message channels in the application!
From a systems integration perspective, is it common practice to use ESB (enterprise service bus) middleware technologies over EJB for mid-to-large sized applications, or is the use of ESB middleware mainly reserved for BPM (business process management) applications?
ESB is mainly used as an integration layer for the purposes of enabling integration of systems talking different message formats, for proxying, routing, message transformation, load balancing, talk different protocols etc. some or all of the above or much more.
An esb may be a full fledged commercial/open source system or just a proxy or router application, which could be implemented using ejb if required.
To comment on ESB and EJB, they are not related and they serve different purposes.
BPM usually involves message orchestration, interaction among different services, message formats and systems and as such an esb tends to come into picture for the purposes of integration. To comment on your point, ESB is neither reserved nor mandatory for BPM.
In my humble opinion, ESB is not just for BPM.
Using ESB allows you to create a distributed architecture.
Benefits of distributed architecture are well known (for example - scalability).
Of course, ESB is not the only solution out there to achieve this,but one of the solutions available.
Pay attention that if you need a distributed architecture , which does not have lots of services + differentiation of protocols (i.e - usage of HTTP, JMS, and more...) you should consider another solution.
ESB can help you when you have many services, which use different protocols (for example, imagine a component that accepts, and another component listening on JMS queue - you might need to send a message which is "logically" the same, but should be once said to the first service, and later on should be sent to the second service - an ESB will help you to perform this task).
I would recommend you to read more on this subject at this blog.
Is there a possibility having transactions across multiple systems?
For exeample:
layer 1 - exposes web services (Deployed to weblogic)
layer 2 - .NET front end (Deployed to IIS)
Can we have transaction commit or rollback for multiple web service calls initiated from .NET?
If so, can someone point me any resource or document? And is there any special requirement for each of the layer comply to participate in transactions?
Yes, it is possible. WCF allows for the consumption of web services that utilize the WS-Atomic Transaction standard, assuming you have System.Transactions.TransactionScope available in your .NET client (Silverlight, for example, does not have this).
There is an excellent example on CodeProject that shows both how to produce and consume transaction web services in .NET using TransactionScope.
casperOne's mention of TransactionScope is an excellent solution if it is available in your scenario. I have fallen in love with the simplicity and power it brings to the table.
However, I note that you have a Java tag and mention Weblogic as the web service tier, so the TransactionScopeRequired property would have to be implemented via WS-AT (Web Services Atomic Transaction) or a similar transcriptional protocol.
See here: http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/cjta_wstran.html
Its definitely possible, but could prove to be harrier than you'd think. You need control to modify the execution environment of those web services to augment them such that they can consume the WS-AT headers. In addition as with any distributed transaction environment you probably will incur a performance increase because of the substantial administrative overhead.
SOA-WORLD had some great articles that explain Web Service transactions and all the related OASIS standards. Here is the one on WS-Coordination if I can find the rest I'll add them.