Results 1 to 10 of 33

Thread: spring config/channel error/error handler

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Posts
    26

    Default 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 at 01:48 PM.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    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.

  3. #3
    Join Date
    Jun 2011
    Posts
    26

    Default

    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.

  4. #4
    Join Date
    Jun 2011
    Posts
    26

    Default

    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"/>

  5. #5
    Join Date
    Jun 2011
    Posts
    26

    Default

    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?

  6. #6
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •