Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPRINGAMQP or RabbitMq Java API

I am new to rabbitMq and Spring AMQP . I am building a new project from scratch . Here for one of the components we are using rabbit-Mq as message broker .

In this project ,primarily all the development has been happening in Java . We are using Spring in general for some of the components .

Now , rabbit-mq though written in Erlang does provide a clean java Api. There is also spring amqp which provides a nice interface to support loose coupling (through AMQPTemplate etc.) .

One advantage which I thought of using SpringAMQP is that because of above mentioned loose coupling , tomorrow if we have to use any other implementation of AMQP than rabbit-Mq(spring-rabbit ) I don't have to change my code . But as I see ,today the implementation is for rabbit-Mq and barring extraordinary circumstances , I don't see anything happening here. We should be using rabbit-Mq for near foreseeable future and also not sure if there is any other message broker implementation thought at spring amqp side other than rabbitMq.

The disadvantage I think is that I am well away off understanding the actual client API RabbitMq provides due to the abstraction Spring AMQP gives(unless I decide to dig really deep) .

In such a case , is there any other advantage SPRING AMQP provides over traditional rabbitMq Java API ?

Thanks

like image 901
Ankur Garg Avatar asked Dec 19 '22 00:12

Ankur Garg


1 Answers

Spring AMQP sits "on top of" the RabbitMQ amqp-client java library, and brings the familiar Spring programming model to RabbitMQ.

It provides similar features to those that Spring JMS users are used to, including message-driven POJOs and the RabbitTemplate.

As with all Spring *Templates, the RabbitTemplate eliminates boilerplate code, cleans up resources automatically, participates in existing rabbitmq transactions, etc., while still allowing you to drop down to the native API if you have advanced needs that are not satisfied by the higher-level API (which is somewhat rare). So, using one does not preclude the other.

Disclosure: I am the project lead.

like image 79
Gary Russell Avatar answered Jan 31 '23 17:01

Gary Russell