A few nouns
- The Java Message Service is a Java standard that defines a common API for using the message broker.
- Message Broker: Similar to the role of a post office, ensure that messages are delivered to the specified destination.
- Destination (destination)
- Queues (queue, point-to-point model): Messages can have multiple recipients, but each message is only taken away by one recipient.
- Topic (topic, point-to-line model): Subscribers who subscribe to this topic receive a copy of this message.
Advantages of asynchronous messages compared to synchronous messages
- Time: Asynchronous messages do not need to wait for the server to return, just send a message.
- Location: A network location that is not dependent on the server.
- Decoupling: You do not need to know the service interface of the server.
- Security: Even when a message is sent, the service does not run properly, and the message is stored until the service can be reused.
Spring support for JMS, including jmstemplate and message-driven Pojo
- Jmstemplate effect: Eliminate lengthy and repetitive JMS code, create connections, get sessions, and send and receive messages, allowing developers to focus on building messages to be sent or processing received messages, capturing subclass-check exceptions for thrown jmsexception exceptions, and re-throws the subclass of the corresponding JMSException exception non-check type exception.
- Message-driven bean (Message-driven bean,mdb): You do not have to proactively view the queue or topic for a message (return or timeout), passively wait for a message to arrive at a notification, and resolve the blocking issue before the message is available to the synchronization message.
Java Message Service Preliminary learning (based on spring in action collation)