-
Copy the files
RabbitMQConfig.java
,RabbitMqDeclarator.java
, andRabbitMqPublisher.java
into a folder within your service. Ensure they are in the same Java package. -
Add the following dependency to your
pom.xml
. For more detailed steps, refer to the library's README: https://github.com/Podzilla/mq-utils-lib/blob/main/README.md<dependency> <groupId>com.github.Podzilla</groupId> <artifactId>mq-utils-lib</artifactId> <version>main-SNAPSHOT</version> </dependency>
-
In the
RabbitMQConfig.java
file, add your event definitions to thePRODUCE_EVENTS
andCONSUME_EVENTS
sets. -
It is mandatory to have
spring.application.name
defined in yourapplication.properties
file. -
To listen to a specific event, use the
@RabbitListener
annotation as shown below:@RabbitListener( queues = "#{ T(com.podzilla.mq.utils.RabbitMqNaming).getQueueName(T(com.podzilla.mq.EventsConstants).ORDER_PLACED, T(com.example.demo.RabbitMQConfig).getServiceName()) }" ) public void listenToOrderPlaced(YourEventType eventPayload) { // Your message processing logic here }
Note: Change
com.example.demo
to the actual package name where you placed theRabbitMQConfig.java
file.
-
Notifications
You must be signed in to change notification settings - Fork 0
Podzilla/templates
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published