简体   繁体   中英

How to deploy Java standalone application on JBoss along with other web applications

I am writing a Java program which will keep on listening to JMS/ActiveMQ queue for any messages. When there is a message posted on the queue, this program will pick up the message and process it. This program has a main() method. Now I want to deploy this program in JBoss/Wildfly. Already there are some web application deployed on JBoss. I want to deploy this program also on JBoss to avoid manual start ups. Whenever the JBoss server starts, this program also should run and listen to queue.

If main method cannot be used I need some advice on alternative solution to this requirement.

In application servers, you can't run a java application. You must deploy a web application as a war or ear.

What you can do:

1) Transform your java standalone application in a web application and define a servlet. This servlet will start your process. So, in this case, when the server starts, it will deploy your package (war or ear), initialize your servlet and then start yout process. 2) Transform your java standalone application in a web application with a scheduler (linux quartz) to start your process. This is better than the first option because you don't have to create a servet.

PS: When you have to run a java standalone application, in general, we use other services to do this job (as Control-M or cron tab in linux)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM