Spring Applications

Exercise: Chat Application (Basic Messaging)

  1. Run the ActiveMQ Artemis message broker:
  2. docker run --name artemis -d --rm -p 61616:61616 -p 8161:8161 -e ANONYMOUS_LOGIN=true
  3. Create a Spring application with the starter spring-boot-starter-artemis as dependency.
  4. Define application properties that provide the URL of the ActiveMQ Artemis message broker and enable the publish-subscribe domain:
  5. spring.artemis.broker-url=tcp://localhost:61616
  6. Implement a publisher and a listener component that allow a user to send text messages to and receive text messages from the topic ChatTopic.
  7. Add a property user to the messages that identifies the sender of the message and display it.
  8. Define a message selector such that the sender's own messages are not received.