Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9040153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:54:53+00:00 2026-06-16T09:54:53+00:00

I don’t understand something. I’m using Spring Integration to send and receive messages from

  • 0

I don’t understand something.
I’m using Spring Integration to send and receive messages from RabbitMQ.

My topology is pretty simple:

  • One JVM produce messages using the RabbitTemplate of Spring

    <rabbit:template id="rabbitTemplate" connection-factory="rabbitConnectionFactory" />
    
    <bean id="amqpTemplate" parent="rabbitTemplate">
        <property name="queue" value="${queue.name}" />
        <property name="routingKey" value="${queue.name}" />
    </bean>
    
  • RabbitMQ queue receive the message

    <rabbit:queue name="${queue.name}" durable="true" />
    
  • Another JVM consume the message (to launch a Spring-Batch job, but that’s not the point):

    <int-amqp:inbound-channel-adapter
          queue-names="${queue.name}"
          channel="amqp-requests"
          connection-factory="rabbitConnectionFactory" />
    

The send method used is:

/**
 * Convert a Java object to an Amqp {@link Message} and send it to a default exchange with a default routing key.
 * 
 * @param message a message to send
 * @throws AmqpException if there is a problem
 */
void convertAndSend(Object message) throws AmqpException;

It works fine but according to the documentation, I don’t think the routingKey is mandatory in my usecase. I don’t know why someone put a routingKey.

So I tried to remove the routingKey:

<bean id="amqpTemplate" parent="rabbitTemplate">
    <property name="queue" value="${queue.name}" />
</bean>

Then I can still send the messages to the queue, but they are never consumed anymore!
Can someone explain me what is going on?
Can’t I send messages from one JVM to another without a routingKey?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:54:54+00:00Added an answer on June 16, 2026 at 9:54 am

    …but according to the documentation, I don’t think the routingKey is mandatory…

    Which “documentation” are you referring to?

    With AMQP, producers do not know about queues; they send messages to various types of exchanges which have bindings for routing to queues.

    Maybe you are mis-understanding the notion of the default exchange, to which every queue is bound, with a routing key equal to its queue name.

    This allows simple routing to specific queues (by way of their names). The default exchange is a convenience to provide a quick on-ramp to amqp messaging. This works fine, but you might want to consider using explicitly declared exhanges instead, because it further decouples the producer from the consumer. With the default exchange the producer has to know the name of the queue that the consumer is listening on.

    Further, on the RabbitTemplate, the queue property is only used for receiving (consuming) messages, it has no bearing on sending messages; as I said producers don’t know about queues.

    You should use the following…

    <bean id="amqpTemplate" parent="rabbitTemplate">
        <property name="routing-key" value="${queue.name}" />
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't understand this simple code: def main(): print (This program illustrates a chaotic function)
Don't freak out about the length of my post, it's pretty simple, I just
Don't really know how to formulate the title, but it should be pretty obvious
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Don't think that I'm mad, I understand how php works! That being said. I
Don't know if I'm using the not selector incorrectly but I want everything clicked
Don't know a whole lot about streams. Why does the first version work using
Don't know where else to ask, but from one day to the other my
Don't know why this is happening, but after submitting a form via JS (using
Don't know is it possible to copy elements from one map to another map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.