How to create multiple employees and associate them with non-web Java applications on Heroku

I tried this tutorial to create two workers on a Heroku server.

But based on this example, I just have one worker running at a time. Is it possible to create 2 workers who start 2 difference jobs when the application starts?

I already tried to scale the workers using: heroku ps:scale worker=2 . But when I do this, it only affects the WorkerProcess class, and I have two WorkerProcess classes at the same time.

0
java heroku worker
Mar 27 '13 at 0:47
source share
1 answer

Yes, you can have as many workflows as you want. They just have to have different names in your Procfile. In the article you pointed out, the only worker is called simply worker , but your Procfile might look something like this with two different workers, called updater and mailer :

 web: java -jar web-app.jar $PORT updater: sh worker/target/bin/updater mailer: sh worker/target/bin/mailer 

If you use the appassembler-maven-plugin shown in this article, you also need to add another <program>...</program> element for each of your workers so that start-up scripts are generated.

+1
Mar 27 '13 at 6:12
source share



All Articles