I would like to implement an application which would span multiple app servers. The idea is that I would put different services on different machines, for instance, a billing service on one, and a booking service on the other. So if the billing server is down, you can still view all the booking information that is not dependent on billing information. It is imperative that the booking of tickets that requires billing services be transactional (across 2 data sources).
How would you go about this in Spring? Spring integration? or something else?
Thanks in advance guys. Any other input regarding the architecture is also very appreciated.
Generally using a Java EE container is best practice for this sort of thing. JBoss and Glassfish are open source application servers and solve exactly the problems that you are looking at.
Spring is one option for configuring applications like this, that span multiple app servers. Send me a message if you would like any extra info on this.
Related
In my firm, we have microservices built on java 8 using springboot.
We have both types of services -
Some TCP services listening on telnet
& some HTTP services taking requests with REST API calls.
I want to trigger a refresh of the environment/all beans for a particular case. Please tell me approaches that can help me achieve this.
PS: I need to implement this for applications running multiple instances.
I am aware of the spring-cloud-actuator and bus refresh, but we are not preferring those for some internal reasons. Please suggest something other than this.
I created a simple two-player game (Connect 4) with a Java/Spring backend and React.js frontend. I understand it would be simpler to create the entire app in React, but I’m studying Java development and decided to learn React to demonstrate my understanding and create a portfolio website.
I’m struggling to decide how best to deploy the app. I deployed the backend on its own to GC App Engine. After a few false starts it eventually worked. However, if I visit the project url from two separate browsers/devices, both devices are looking at the same instance of the backend, i.e. two individual users are looking at the same ‘game’, which is not what I intended.
What is the best approach to deploy the front & backend so each user is playing their own individual game?
This is literally my first foray into any kind of web development, so I may have bitten off more than I can chew.
Thanks.
I would suggest you use multiple services on your project. You can either use the same deployment command for deploying or updating the services that make up your application.
services in App Engines behave like microservices and therefore you can deploy multiple services to run as a set of microservices.
Here are the requirements for deploying multiple services:
You must initially deploy a version of your application to the default service before you can create and deploy subsequent services.
The ID of each of your services must be specified in their corresponding app.yaml configuration files. To specify the service ID, include the service element definition in each configuration file. By default, excluding this element definition from your configuration file deploys the version to the default service.
You can deploy one service as frontend and the other as backend.
You can check this documentation on services for additional information.
I looked at the documentation regarding services but I still don’t understand their use in the context of my problem. I may have misunderstood your explanation, but I don’t think I explained my problem clearly. Having looked at the documentation, my use of the word ‘instance’ is not the same as an app engine instance.
It would make sense to me to have two services in my project; one for the backend and one for the frontend. To solve the problem of each individual player interacting with the same backend API, and so unwittingly interacting with the same single Connect4 game, generating multiple services would not be a solution. Is my understanding correct?
The comment from NoCommandLine on my original post is probably a better description of what I want to achieve.
We have a number of related Java Spring applications running on our servers. Lets call them App1, App2 & App3. As is standard all these use the common code in our-common-utils.jar
I want these applications(App1, App2 & App3) to broadcast their state to one or more remote listeners. For e.g.
App1: I failed to read file abc.
App2: I am using more than 90% of my heap space etc.
The listener/s of these events will take specific actions such as send emails to support and/or clients based on the notifications received.
The best solution I can think of is to have a NotificationSender JMX enabled(implements NotificationBroadcasterSupport) bean in our-common-utils.jar. This will have a thread consuming from a queue of Notifications and firing off sendNotification() to the listeners for each Notification. This will be done by each of the Apps in our eco system but using common code from common-utils.
Do you see any flaws in this design? Any more efficient ways/frameworks of doing it?
Many Thanks :)
Alternative solution is to use any distributed coordination service zookeeper for example. I used it in my very first micro service project. As I can see you are using spring. Spring cloud provides necessary solutions that you can use in declarative way. I would pay your attention to #FeignClient. It is very simple in use and flexible in spring world.
If I would work on this issue now, I would use spring hystrix based solution. To simplify integration between your java services I would recommend to check service-registration-and-discovery.
Ignore my opinion if spring is not general engine part in your projects (may be you need other vendor solutions, there are a lot of alternatives). I concentrate my attention on spring solutions because spring is not restricted in my projects and I can use anything I wish if it's reasonable.
I have a Spring web application that consists of the following parts:
Web GUI for Users
Background processes
Webservice-like API
It's all in one application. For every update, the whole application has to be stopped and redeployed, which of course means that all users are kicked out and the API is temporarily unavailable.
I am wondering whether there a ways to seperate the application into several applications/services which could be deployed seperately. All applications would need access to the DAOs and to several utility classes/services.
I know there will be no ready-made solution for this. But maybe you can show some 'best practice examples' or show me some direction where I could go.
But if some part of the application is offline while redeployment, the complete application will not work, so this is likely that the split is not the solution.
If the problem is just that the users session is killed, then you should have a look at values stored in the session that are not able to been serialized.
If your probem is that the application is offline for some time, then you need a second server and some switch (loadbalancer) to implement a blue-green-deployment
I have a web service, that takes an input xml message, transforms it, and then forwards it to another web service.
The application is deployed to two web logic app servers for performance, and resilience reasons.
I would like a single website monitoring page that allows two things
ability to stop/ start forwarding of messages
ability to monitor throughput of number of messages in the last hour etc. Number of different senders into the webservice etc.
I was wondering what the best way to implement this was.
My current idea is to have an in memory database (eg Debry or HSQL) replicating data to share the information between the two (or more) instances of my application that are running in different instances of the app server. I imagine I would have to setup some sort of master/ slave configuration.
I would love a link to an article that discusses how to solve this problem.
(Note, this is a simple spring application using spring MVC)
thanks,
David.
This sounds like a good match for Java Management Extensions (JMX)
JMX allows you to expose certain operations (eg: start/stop forwarding messages)
JMX allows you to monitor certain performance indicators (eg: moving average of messages processed)
Spring has good support for exposing beans as JMX MBeans. See here for more information.
Then you could use an open-source web-based JMX console, such as jManage
Hope this helps.
Sounds like you are looking for a Message Queue, some MDBs and a configurable design would let you do all these. Spring has support for JMS Queues if I'm not wrong
I think you are looking for a message queue. If you need additional monitoring, using a web service as the end point may not suffice - with regards to stop/start or forwarding of messages; monitoring http requests to web service is more cumbersome than tracking messages to a queue (even though you can do it).
If you are exposing this service to third party, then the web service will sit on top of the message queue and delegate to to it.
In my experience, RabbitMQ is a fine messaging queue service with a relatively simple learning curve.