I don't know that well, so this needs to be studied.
JMS has 2 types of message domains
Point-to-point mode 1.
2. Publish subscription mode Publish/subscribe pub/sub mode
Traditional JMS API Development
Currently there is no environment, so now write a demo, back to the environment to test a
Package Jms;import Javax.jms.connection;import Javax.jms.connectionfactory;import javax.jms.destination;import Javax.jms.jmsexception;import Javax.jms.messageproducer;import Javax.jms.session;import javax.jms.TextMessage; Import Javax.naming.context;import Javax.naming.initialcontext;import Javax.naming.namingexception;import org.junit.test;/** * Test JMS method * @author xiaof * */public class JmsTest1 {/** * JMS message send */@Testpublic void test1 () {Connecti on con = null; Session session = Null;try {//get jndicontext context = new InitialContext (); ConnectionFactory connectionfactory = (connectionfactory) context.lookup ("Jndi/jms/connectionfactory");D estination Destination = (destination) context.lookup ("jndi/jms/destination"); con = connectionfactory.createconnection ();// Create Connection Session = Con.createsession (false, Session.auto_acknowledge); MessageProducer messageproducer = session.createproducer (destination); Set Object TextMessage message = Session.createtextmessage (); Message.settext ("Hi"); Messageproducer.send (message); Messageproducer.close (); Session.close ();} catch (Namingexception e) {//Todo auto-generated catch Blocke.printstacktrace ();} catch (JMSException e) {//Todo Auto-ge Nerated catch Blocke.printstacktrace ();} Finally {//close resource if (con! = null) {try {con.close ()} catch (JMSException e) {//TODO auto-generated catch Blocke.printstackt Race ();}}}}
Spring improved post- JMS
Jmstemplate again, see the template I will not more BB, we know, now understand, template mode is really very powerful
I don't have a lot of BB, everybody go to see the template package, I'm sick of it.
Anyway, this template just encapsulates a bunch of methods to simplify our operation.
Forget it, watch the message queue and then add it.
Task scheduling and thread pooling support in spring
Quartz
Divided:
Job,jobdetail,trigger,scheduler
How does spring fit into the quartz?
The timer in the JDK
"Sping Secret" 24, spring Framework for JMS Integration (no environment version, later when learning MQ again) & Task scheduling and thread pool