How to set up a common java project, host and run on a server

Asked

Viewed 318 times

0

Whoa, good night guys, so with some questions about java systems running without server.

Some friends and I are developing a java integration project (we receive information from a server/service, treat it on our system and then forward it to another service (such as email or trello)), our program runs perfectly on our machines but we do not know how to configure this project to run on a server.

The program would have to be listening at all times to the arrival of information from one of the services, how would this be done? put an infinite while and treat when arriving something or there is a function for such? and if there is any other information in the meantime that the system is processing something, such as avoiding q being lost, since the program would not be listening but taking care of the processing of the data that came before?

In addition, the project was done in normal java (without jsf, War or Tomcat installed), as I would convert to a type of project that would be accepted by a hosting service (have some specific or recommended?)

Any tips or recommendations for hosting service? I got 2 months free on Uol Host Cloud Openstack service, I can use it for what I want or need a web hosting in java?

Thank you very much and sorry for the numerous questions :/

  • João Pedro Silva December, how about the tour welcome Sopt? This way you can make the most of the forum and users.

1 answer

1

Hey, good night, man. You haven’t specified what kind of information you expect as an input in java, but regardless, you need to use a concept called Threads! Each thread is a parallel execution in java, meaning you can have multiple processes at the same time. In short, you could do it with a while true and when you receive a request (arrival of the expected information), the system opens a thread for that request and so the system will continue to expect another request while processing the previous one. I hope it helped :)

  • We will receive jsons, we have already made the code of the treatment of the model that we will receive but at the moment we are only loading from a local file. Another question I have is exactly how this "listening" would be done to wait for a request from an external service. They would send us an address but how do I listen and save this data they will send us? Mto obg! (By the way, I’ve heard about Threads before but I’ve never researched in depth, I’ll take a closer look now)

  • 1

    In this case, do a search for Servlet in java. The Servlets have the function of carrying out client-server communication and can be the solution to your problem. I also recommend you give a read on REST and Restful for future projects! You will not regret !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.