## Notes *JMS* provides APIs for allowing computers to communicate over a network. Supports event-based paradigm, publishing, etc. ## Benefits - Asynchronous by default; message receiver is not required to be online - Reliable: once and only once ## Point-to-Point Messaging - Message Queues, Senders, and Receivers Sender sends a message to a particular Message Queue. The queue maintains the message until all subscribers have seen the message or the message expires. - There is only one client for each message - No timing dependency for sending a message - No timing dependency for receiving a message - Receiver can fetch message whenever it is ready - Receiver sends acknowledgement (to the queue) that message is received ## Pub-Sub Messaging A *Topic* acts as a bulletin board. Publishers and Subscribers are anonymous and can dynamically publish/subscribe. The Topic is responsible for holding and delivering messages. The Topic retains messages until it is delivered to present clients. - Can have multiple subscribers for a message - Publisher and Subscriber can have time limits ## Receiving a Message ### Synchronous Subscriber gets the message by calling `receive()`. This will block until the message is received or timeout is reached. ### Asynchronous ## References - [Java Message Service - How To Do In Java](howtodoinjava.com/jms/jms-java-message-service-tutorial/)