RabitMQ 2.Work Queue

Let’s follow the example to understanding the concepts.

Step 1: Create a Java Class with named NewTask.Java

Import the following

Step 2: Create a Java Class with named Worker.Java

Import the same used in NewTask.java

Step 3: Compile classes and run RabbitMQ

Step 4: Create multiple consumers

Step 5: Publish Tasks

  1. Create a new console which represents our publisher and publish a task using the command java -cp %CP% NewTask First message.
  2. Then, only the first consumer got the message.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store