The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

mike22 (2) [Avatar] Offline
# One problem is I started using maven 2, and I don't know how to run a simple standalone in eclipse or at the command line

# But first, start jms broker:
$ cd /wherever/apache-activemq-5.5.1/macosx
$ activemq start

# go to the standalone sia example
$ cd /~/projects/messaging

#eclipse needs to know the path to the local maven repository
$ mvn eclipse:eclipse

# now open ~/projects/messaging in eclipse and it should find .m2
# good news: no red Xs in eclipse !
# good news: in Java Build Path, all the M2_REPO jars are happy !
# notice tcp://localhost:61616 is hard coded in com.springinaction.messaging.ConventionalReceiver,
# so it should find the running message broker
# sysouts are showing in console

# was helpful

# to run receiver at command line
$ cd /Users/michaelsweeney/projects/messaging
$ mvn exec:java -Dexec.mainClass=com.springinaction.messaging.ConventionalReceiver &
# you should see your sysouts e.g. "020.30 main() in ConventionalReceiver"
$ ps -ef |grep java
# you should see the receiver waiting

# now run sender at command line
$ mvn exec:java -Dexec.mainClass=com.springinaction.messaging.ConventionalSender

#if you put a sysout in the receiver right after :
Message message = consumer.receive();
... you should it after you do the send