RabbitMQ cannot bind JMS exchange to queue

102 views Asked by At

I face an odd issue when I bind an x-jms-topic exchange to a queue using the JMS plugin rabbitmq_jms_topic_exchange as RabbitMQ is not a JMS provider. I face the issue that neither the UI nor the command line succeeds in creating the binding.

Here are my steps:

  1. I use this docker-compose file with no modifications, except I tried two images:

    • rabbitmq:3-management-alpine (default)
    • rabbitmq:3.12.8-management-alpine
  2. Upon starting-up the RabbitMQ instance, I enable the JMS plugin in the Docker container:

    rabbitmq-plugins enable rabbitmq_jms_topic_exchange
    
  3. I create a JMS exchange jms-exchange and queue jms-queue (either UI or command line)

    rabbitmqadmin declare exchange name=jms-exchange type=x-jms-topic
    
    rabbitmqadmin declare queue name=jms-queue durable=false
    
  4. So far so good, now create a binding (again either UI or commandline) where the routing key has the same name as the queue for the sake of simplicity:

    rabbitmqadmin declare binding source=jms-exchange destination=jms-queue routing_key=jms-queue
    
  5. The last command gives me an obscure error that says nothing useful, here is what I get both in UI and the command line:

    *** Request to node rabbit@f823cbcfe081 failed with {'EXIT',
        {function_clause,
         [{erl_scan,string,
           [error,1,[]],
           [{file,"erl_scan.erl"},
            {line,156}]},
          {rabbit_jms_topic_exchange,
           decode_term,1,
           [{file,
             "rabbit_jms_topic_exchange.erl"},
            {line,205}]},
          {rabbit_jms_topic_exchange,
           generate_binding_fun,1,
           [{file,
             "rabbit_jms_topic_exchange.erl"},
            {line,189}]},
          {rabbit_jms_topic_exchange,
           add_binding,3,
           [{file,
             "rabbit_jms_topic_exchange.erl"},
            {line,123}]},
          {rabbit_exchange,
           '-callback0/5-lc$^0/1-0-',
           4,
           [{file,
             "rabbit_exchange.erl"},
            {line,54}]},
          {rabbit_exchange,callback,
           4,
           [{file,
             "rabbit_exchange.erl"},
            {line,49}]},
          {rabbit_binding,add,3,
           [{file,
             "rabbit_binding.erl"},
            {line,133}]},
          {rabbit_channel,
           binding_action,10,
           [{file,
             "rabbit_channel.erl"},
            {line,1863}]}]}}
    
    

I can bind any exchange type (direct, fanout...) to the queue but not x-jms-topic. The following works:

rabbitmqadmin declare binding source=amq.direct destination=jms-queue routing_key=jms-queue

What is the issue? Perhaps I misunderstood the role of JMS in RabbitMQ. I intend to connect to the RabbitMQ via the JMS connector using Spring Boot.

  • How to configure RabbitMQ + JMS in the minimum form?
  • If the exchange (of x-jms-topic type) cannot be bound to the queue, what is its role in the JMS concept?
0

There are 0 answers

Related Questions in RABBITMQ-JMS