简体   繁体   中英

Open JMS run basic example

I am trying to setup the OpenJMS on my machine and trying to run the basic example from command line. However, I am not able to figure out how to do it.

This is what I have done so far,

Run the Open JMS

➜  bin ./startup.sh
Using OPENJMS_HOME: /Users/gaurang.shah/Documents/personal/jms/openjms-0.7.7-beta-1
Using JAVA_HOME:    /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
OpenJMS 0.7.7-beta-1
The OpenJMS Group. (C) 1999-2007. All rights reserved.
http://openjms.sourceforge.net
11:46:59.353 INFO  [main] - Server accepting connections on tcp://192.168.2.12:3035/
11:46:59.355 INFO  [main] - JNDI service accepting connections on tcp://192.168.2.12:3035/
11:46:59.356 INFO  [main] - Admin service accepting connections on tcp://192.168.2.12:3035/
11:46:59.453 INFO  [main] - Server accepting connections on rmi://192.168.2.12:1099/
11:46:59.453 INFO  [main] - JNDI service accepting connections on rmi://192.168.2.12:1099/
11:46:59.454 INFO  [main] - Admin service accepting connections on rmi://192.168.2.12:1099/

Start the Sender

➜  basic ./run.sh Sender new_topic 1
Using OPENJMS_HOME: /Users/gaurang.shah/Documents/personal/jms/openjms-0.7.7-beta-1
Using JAVA_HOME:    /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Using CLASSPATH:    ./:/Users/gaurang.shah/Documents/personal/jms/openjms-0.7.7-beta-1/lib/openjms-0.7.7-beta-1.jar
hello

Start the Receiver

➜  basic ./run.sh Receiver new_topic
Using OPENJMS_HOME: /Users/gaurang.shah/Documents/personal/jms/openjms-0.7.7-beta-1
Using JAVA_HOME:    /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Using CLASSPATH:    ./:/Users/gaurang.shah/Documents/personal/jms/openjms-0.7.7-beta-1/lib/openjms-0.7.7-beta-1.jar

However, I am not able to get anything on the receiver side.

In JMS if a message is sent to a topic then all the subscribers on that topic receive the message. If there are no subscribers on the topic then any message sent to the topic is discarded (ie the message is not stored). This is basic publish-subscribe semantics.

Therefore, if you send the message before you start your receiver/subscriber then it won't receive the message.

Start the receiver before sending the message and it should receive it.

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