-
Notifications
You must be signed in to change notification settings - Fork 19
How to use it
In this page, we gonna walk through how to use Consumer Dispatcher.
If you download the packaged jar file directly, you could skip to how to run it section.
- clone the code from github. goto your working dir.
git clone [email protected]:jackyhung/consumer-dispatcher.git
cd consumer-dispatcher
- run maven command:
mvn package
-
check out the folder called 'target' from where you will find the jar file:
consumerdispatcher-X.Y.Z-jar-with-dependencies.jar
-
if you want to make it as eclipse project, goto the
consumer-dispatcher
folder, run mvn command
mvn eclipse:eclipse
then import this project into your eclipse.
After you get your consumerdispatcher-X.Y.Z-jar-with-dependencies.jar
file, you could run your instance up by following the steps below.
- new a file called job.xml, copy and paste the content of example of job.xml.
PS: change the job definitions, and change the queueserver definitions before you save the file
-
put your consumerdispatcher-X.Y.Z-jar-with-dependencies.jar and job.xml into the same folder.
-
run command:
java -jar consumerdispatcher-X.Y.Z-jar-with-dependencies.jar job.xml
- you dont have problem to run Consumer Dispatcher up with the command above, but you might have problem of connecting to Consumer Dispatcher via JMX client, then you need to run like this:
java -Djava.rmi.server.hostname=YOUR_IP_OR_HOSTNAME -jar consumerdispatcher-X.Y.Z-jar-with-dependencies.jar job.xml
- check the log file: consumerDispatcherLog.log you will see it ends like
12-05-31 13:30:39 INFO job.JobAssign(Line:28) [main] - ===== started up 53 jobs ====
12-05-31 13:30:40 INFO jmx.ConsumerDispatcherMonitor(Line:44) [main] - JMX enabled on:service:jmx:rmi:///jndi/rmi://YOUR_IP:9999/jmxrmi
12-05-31 13:30:40 INFO jmx.ConsumerDispatcherMonitor(Line:71) [main] - mx4j successfuly loaded at YOUR_IP:8888
-
from now on, your Consumer Dispatcher is running. You could publish a job to the queue with your publisher code. Once the job published to the queue successfully, the Consumer Dispatcher will get it from RabbitMQ and dispatch them to your consumer code by sending HTTP POST request(explanation of how it works). you can watch what's going on by tailing the log file
tail -f consumerDispatcherLog.log
. -
and you can - Managing & Monitoring via jconsole (with url: service:jmx:rmi:///jndi/rmi://YOUR_IP:9999/jmxrmi) or via browser (with url http://YOUR_IP:8888)