Skip to content

Instantly share code, notes, and snippets.

@jahe
Last active May 30, 2017 08:58
Show Gist options
  • Select an option

  • Save jahe/252f0e22e1a36b38f38edfa1067c9c63 to your computer and use it in GitHub Desktop.

Select an option

Save jahe/252f0e22e1a36b38f38edfa1067c9c63 to your computer and use it in GitHub Desktop.
JMS Cheatsheet
Java Messaging - JMS 2.0
JMS - Interface to send messages
Message - Usually text or bytes
Producer - Creates messages
Consumer - Receives messages
Destination - Sits between the Producer an the Consumer
There are two types of Destinations:
1. Queue - Message can be received by only one Consumer (First come first serve)
2. Topic - Message can be received by any Consumers listening
- Special type of Queue
- It gureentees delivery to all Consumers that subscribed to the Topic
- If no one is listening the message is dropped:
You only get the Message if you are listening
Durable Subscriber - Special kind of Consumer of a Topic
All Messages get to it when it reconnects to the Topic
The communication is asynchronous:
The consumer can decide when to receive the message
// Send a message that is persistent (in a db or another datastore) so that it survives a broker restart
DeliveryMode.PERSISTENT
// Send a message that doesn't survive a broker restart
DeliveryMode.NON_PERSISTENT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment