Announcement Announcement Module
Collapse
No announcement yet.
Spring AMQP 1.3.4 is Now Available Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AMQP 1.3.4 is Now Available

    https://spring.io/blog/2014/03/28/sp...p-1-3-released

    This fixes a problem with the pom for spring-retry in Friday's 1.3.0.RELEASE.

    1.3.2 Adds a default error handler to prevent endless retries of messages that have conversion failures.

    1.3.3 Adds support for rabbitmq amqp-client 3.3.x

    1.3.4 Restores listener exception logging.
    Last edited by Gary Russell; Jun 2nd, 2014, 06:41 PM.

  • #2
    Hi Gary,

    I am getting following exception when switched from 1.1.4 to 1.3.2
    Exception in thread "SimpleAsyncTaskExecutor-1" java.lang.NoSuchMethodError: com.rabbitmq.client.ShutdownSignalException.getRea son()Ljava/lang/Object;
    at org.springframework.amqp.rabbit.connection.RabbitU tils.isNormalShutdown(RabbitUtils.java:167)
    at org.springframework.amqp.rabbit.listener.SimpleMes sageListenerContainer$AsyncMessageProcessingConsum er.run(SimpleMessageListenerContainer.java:1037)
    at java.lang.Thread.run(Thread.java:722)


    Here is the reason I found:

    ShutdownSignalException.getReason() returns 'com.rabbitmq.client.Method', where as in 'RabbitUtils.isNormalShutdown' it is used to return Object. (ObjectshutdownReason=sig.getReason()

    Can you please look into it as it is stopping us from migration

    Comment


    • #3
      This looks like a recent change to the rabbit client; can you try with the 3.2.4 client library?

      Comment


      • #4
        I can confirm there are a number of breaking changes in the 3.3.x client. I opened a JIRA issue to resolve them https://jira.spring.io/browse/AMQP-394

        Comment


        • #5
          It works with amqp-client:3.2.4. Thanks for quick response.

          Comment


          • Gary Russell
            Gary Russell commented
            Editing a comment
            Spring AMQP 1.3.3 supporting the 3.3.x client is now available in repo.spring.io and should be in Maven Central in a few hours.

        • #6
          When defining listener-container in applicationContext.xml, looks like we are forced to define queues; I get BeanCreationException if queues or queue-names are not provided. We would like to add queues via addQueues before starting the listener. Is this possible?

          Comment


          • #7
            Can you provide a full stack trace? I don't think that check is done until the container is start() ed. So, you should be ok if you set autoStartup="false".

            Comment


            • #8
              Yes, I have set autoStartup=false.

              Here's the stacktrace


              SEVERE: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.Dependenc [email protected]] to prepare test instance [[email protected]]
              java.lang.IllegalStateException: Failed to load ApplicationContext
              at org.springframework.test.context.CacheAwareContext LoaderDelegate.loadContext(CacheAwareContextLoader Delegate.java:99)
              at org.springframework.test.context.DefaultTestContex t.getApplicationContext(DefaultTestContext.java:10 1)
              at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.injectDependencies (DependencyInjectionTestExecutionListener.java:109 )
              at org.springframework.test.context.support.Dependenc yInjectionTestExecutionListener.prepareTestInstanc e(DependencyInjectionTestExecutionListener.java:75 )
              at org.springframework.test.context.TestContextManage r.prepareTestInstance(TestContextManager.java:326)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTest(SpringJUnit4ClassRunner.j ava:212)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner$1.runReflectiveCall(SpringJUnit4Clas sRunner.java:289)
              at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:12)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.methodBlock(SpringJUnit4ClassRunner. java:291)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:232)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.runChild(SpringJUnit4ClassRunner.jav a:89)
              at org.junit.runners.ParentRunner$3.run(ParentRunner. java:238)
              at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:63)
              at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:236)
              at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:53)
              at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:229)
              at org.junit.internal.runners.statements.RunBefores.e valuate(RunBefores.java:26)
              at org.springframework.test.context.junit4.statements .RunBeforeTestClassCallbacks.evaluate(RunBeforeTes tClassCallbacks.java:61)
              at org.junit.internal.runners.statements.RunAfters.ev aluate(RunAfters.java:27)
              at org.springframework.test.context.junit4.statements .RunAfterTestClassCallbacks.evaluate(RunAfterTestC lassCallbacks.java:71)
              at org.junit.runners.ParentRunner.run(ParentRunner.ja va:309)
              at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.run(SpringJUnit4ClassRunner.java:175 )
              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
              at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
              at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
              Caused by: org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Listener 'queue-names' or 'queues' attribute must be provided.
              Offending resource: URL [file:/[...snipped...]/processor/target/classes/spring/applicationContext.xml]
              at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :70)
              at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
              at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:72)
              at org.springframework.amqp.rabbit.config.ListenerCon tainerParser.parseListener(ListenerContainerParser .java:163)
              at org.springframework.amqp.rabbit.config.ListenerCon tainerParser.parse(ListenerContainerParser.java:79 )
              at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:74)
              at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1424)
              at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1414)
              at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:187)
              at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.doRegisterBeanDefinitions( DefaultBeanDefinitionDocumentReader.java:141)
              at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:110)
              at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:508)
              at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:391)
              at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:335)
              at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:303)
              at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:180)
              at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:216)
              at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:187)
              at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:251)
              at org.springframework.test.context.support.AbstractG enericContextLoader.loadBeanDefinitions(AbstractGe nericContextLoader.java:235)
              at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:118)
              at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:60)
              at org.springframework.test.context.support.AbstractD elegatingSmartContextLoader.delegateLoading(Abstra ctDelegatingSmartContextLoader.java:100)
              at org.springframework.test.context.support.AbstractD elegatingSmartContextLoader.loadContext(AbstractDe legatingSmartContextLoader.java:250)
              at org.springframework.test.context.CacheAwareContext LoaderDelegate.loadContextInternal(CacheAwareConte xtLoaderDelegate.java:64)
              at org.springframework.test.context.CacheAwareContext LoaderDelegate.loadContext(CacheAwareContextLoader Delegate.java:91)
              ... 27 more

              Last edited by ashburnite; May 14th, 2014, 07:45 AM.

              Comment


              • #9
                Configuration problem: Listener 'queue-names' or 'queues' attribute must be provided.
                It says that one of these attribtes should be provided.
                Since you are going to add queues at runtime, I'd suggest to provide some fake queueName and remove it before real queus initialization.
                Everything is done after container startup

                Comment


                • #10
                  Or you can just wire up the SimpleMessageListenerContainer as a <bean/>; that check is being done by the namespace parser and it requires one or the other attribute.

                  The container itself doesn't check that it has at least one queue until it's start() ed.

                  Comment


                  • #11
                    Thanks both! Is it your intent to have queue or queue-name as a required attribute? why not make it optional and validate container during startup?

                    Comment


                    • #12
                      We could relax that requirement; it has just never come up before. Feel free to open a JIRA 'Improvement; issue: https://jira.spring.io/browse/AMQP

                      Comment


                      • #13
                        Update: Fixed.
                        The exception was being raised on AutorecoveringConnection [line: 491] - recoverConsumers(), where it tried to, for each queue, recover all consumers - but couldn't. Setting the flag topologyRecover to false fixed that.

                        ----

                        Hi guys,

                        I was having some problems with the ShutdownSignalException and this new version fixed it, but a new one showed up right after
                        I also noticed that my consumers aren't being closed - I had 15 consumers on a given queue and after restarting Rabbit I ended up with 30, then 45, and so on...
                        No exceptions are raised during the restart, only later when I try to consume messages (stacktrace below). Debugging I saw that the code does go through restart()
                        on SimpleMessageListenerContainer, without throwing an exception.s

                        Any ideas?




                        Stacktrace:

                        Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-hw7gxNv9AJfUR91PMeBKkw
                        com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-hw7gxNv9AJfUR91PMeBKkw
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCo nnection.recoverConsumers(AutorecoveringConnection .java:491)
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCo nnection.beginAutomaticRecovery(AutorecoveringConn ection.java:366)
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCo nnection.access$000(AutorecoveringConnection.java: 48)
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCo nnection$1.shutdownCompleted(AutorecoveringConnect ion.java:345)
                        at com.rabbitmq.client.impl.ShutdownNotifierComponent .notifyListeners(ShutdownNotifierComponent.java:75 )
                        at com.rabbitmq.client.impl.AMQConnection$MainLoop.ru n(AMQConnection.java:572)
                        at java.lang.Thread.run(Thread.java:724)
                        Caused by: com.rabbitmq.client.AlreadyClosedException: connection is already closed due to connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - attempt to reuse consumer tag 'amq.ctag-liy1EPIPVKqQ9yOahdLKzw', class-id=60, method-id=20)
                        at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(A MQChannel.java:190)
                        at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel .java:223)
                        at com.rabbitmq.client.impl.ChannelN.basicConsume(Cha nnelN.java:981)
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCh annel.basicConsume(AutorecoveringChannel.java:312)
                        at com.rabbitmq.client.impl.recovery.RecordedConsumer .recover(RecordedConsumer.java:45)
                        at com.rabbitmq.client.impl.recovery.AutorecoveringCo nnection.recoverConsumers(AutorecoveringConnection .java:484)
                        ... 6 more
                        Last edited by lleite; May 14th, 2014, 12:51 PM.

                        Comment


                        • #14
                          How are you killing RabbitMQ? When you say 30, then 45, do you mean on the admin console or you have that number of consumer threads. It sounds like the server bounce (socket close) is not being propagated to the client.

                          Comment


                          • #15
                            Also what is your consumer cache size?

                            Comment

                            Working...
                            X