Announcement Announcement Module
Collapse
No announcement yet.
spring config/channel error/error handler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring config/channel error/error handler

    Have a few related questions here.

    I have my project working but I am getting some annoying errors.

    First I am getting a ShutdownSignalException -> UnknownChannelException: Unknown channel number 2.

    Perhaps I have the queue configured wrong? Think I read somewhere that queues will delete if not in use, but I have a background listener (SimpleListenerContainer) and rabbitmqctl still shows the queue. I am not clear on this channel business either.

    Its probably just me but the spring-amqp documentation seems weak, especially for using xml config (I know it appears old school now). For instance section 1.8 says that I can inject an ErrorHandler into SimpleMessageListenerContainer, how? I have looked at the class and do not see an attribute to set.

    and where do I find the schema for spring-intergration-amqp
    Last edited by slyfox; Jun 22nd, 2011, 01:48 PM.

  • #2
    I think we'll need more detail on the ShutdownSignalException. This is thrown by the RabbitMQ Java client if you try and use a closed channel. Why the channel is closed is really the question. A stack trace would help, and probably some configuration.

    Queues are deleted when not in use if they are declared to be exclusive. You can do that with Spring AMQP, but it isn't the default, and Spring AMQP will re-create such queues if the connection is dropped and has to be refreshed. If rabbitmqctl shows the queue then it is obviously there.

    Suggestions for where to improve the documentation are more than welcome - specific requests in JIRA is the way to make sure they are addressed. What did you want to do with your ErrorHandler? SimpleMessageListenerContainer has a setter for it (in a base class), and it's also available through the XML schema (which would show up using auto-complete in your editor), so I'm surprised you couldn't find it.

    Spring Integration AMQP is at http://git.springsource.org/spring-integration/sandbox.

    Comment


    • #3
      Dave,

      Thanks for the reply. I am getting closer. And I apologize for the documentation comment, it sounded rude, not my intention. I am more on the novice end...However I did get the 2.1.0.BUILD-SNAPSHOT of the spring-integration-amqp. I am doing this because I keep getting an unknown channel error, it seems all of my errors stem from this. I thought amqp uses just one default channel if none are defined. Do I *need* to always specify a channel in the config? My configuration is extremely basic:

      <rabbit:admin id="amqpAdmin" connection-factory="cf"/>
      <rabbit:queue name="queue.trades.test" durable="true"/>
      <rabbit:listener-container connection-factory="cf">
      <rabbit:listener queues="queue.trades.test" ref="fixSession"/>
      </rabbit:listener-container>
      <amqp:inbound-channel-adapter queue-name="queue.trades.test"
      channel="inboundChannel"
      connection-factory="cf"/>

      of course now that I have the new libraries I am getting a new error that 'queue-name' is not allowed to appear in element 'amqp:inbound-channel-adapter', even though it was an auto complete and added for me.

      Comment


      • #4
        ok so this is what I am getting:
        WARN [SimpleAsyncTaskExecutor-1] (SimpleMessageListenerContainer.java:527) - Consumer raised exception, processing can restart if the connection factory supports it
        org.springframework.amqp.AmqpIOException: java.io.IOException
        later in the stack trace...
        reply-text=PRECONDITION_FAILED - parameters for queue 'queue.trades.test' in vhost '/' not equivalent

        with this config

        <rabbit:admin id="amqpAdmin" connection-factory="cf"/>
        <rabbit:queue name="queue.trades.test" durable="true"/>
        <bean id="fromAMQP" class="org.springframework.integration.channel.Que ueChannel"/>
        <amqp:inbound-channel-adapter queue-names="queue.trades.test"
        channel="fromAMQP"
        connection-factory="cf"/>

        Comment


        • #5
          it seems that if I restart the rabbitmq server the error goes away.

          so I am wondering if this is what happened...
          in testing I may have initially created the queue without declaring it durable. Then subsequently I did add the durable=true, so in my later attempts what I was requesting of the server did not match up. Not aware if the server keeps that info cached but is this possible?

          Comment


          • #6
            Not only possible but highly likely. The error is indeed the server telling you that you declared the queue twice with inconsistent parameters (which is an error).

            The auto-complete for the schema must have been using an older (cached, maybe, or maybe on the internet) version of the schema (queue-name -> queue-names before RC1 of Spring AMQP). If you use the latest STS tooling it should work out of the box, allegedly.

            Comment


            • #7
              XML schema

              Dave,

              Thanks for the replies. Have the amqp issue resolved but still get a validation error when using queue-name in the channel adapter tag.

              queue-names works and I have a reference to 2.0.xsd, are you saying this is incorrect? I assume it is because the doc uses queue-name but I cannot get it to work.

              Tried in STS as well

              Thanks

              Comment


              • #8
                I can push a new 2.1.0.BUILD-SNAPSHOT for spring-integration-amqp that explicitly references 1.0.0.RC2 of the underlying Spring AMQP (now that it's available). That would likely resolve this. I'll let you know when it's deployed.

                Comment


                • #9
                  2.1.0.build-snapshot

                  Mark,

                  Were you able to push the new release, I just got back from vacation and do not see it.

                  Thanks,
                  Bobby

                  Comment


                  • #10
                    I just deployed it. You should find the latest spring-integration-amqp snapshot depends on Spring AMQP 1.0.0.RC2 now.

                    Thanks for the reminder.
                    -Mark

                    Comment


                    • #11
                      Still having a minor issue

                      So I have verified that I am now dependent on spring-amqp.1.0.0.RC2 rather than the snapshot. However I am still experiencing the same issue.

                      For the inbound channel adapter

                      queue-names gets a validation error in the ide, but works upon runtime (app works as expected)
                      queue-name passes validation in ide but fails at runtime. queue-name seems correct in the doc.

                      xmlns:amqp="http://www.springframework.org/schema/integration/amqp"

                      my schema location:
                      http://www.springframework.org/schema/integration/amqp
                      http://www.springframework.org/schem...n-amqp-2.0.xsd

                      I know this is something that I am doing wrong.

                      Comment


                      • #12
                        What version of STS are you using?

                        Comment


                        • #13
                          2.1 xsd

                          STS v2.6

                          To confirm I am using spring-integration-amqp.2.1.0-BUILD-SNAPSHOT

                          in the config package is the 2.0.xsd

                          in the definitions it defines queue-names as required

                          Comment


                          • #14
                            If it works at runtime you should be able to ignore errors in the XML editor, and "queue-names" is the correct attribute name. Sometimes you need to force a re-validation to make them go away, e.g. select all, cut, save, refresh dependencies (little icon in the toolbar), paste, save.

                            Comment


                            • #15
                              Last error

                              Ok thank you guys for all of your help. App is running but now with this new inbound channel adapter I seem to be getting only every other message. Since its an even number and consistent I would assume this is a channel issue, am I on the right track?

                              Comment

                              Working...
                              X