Spring-amqp with RabbitMQ does not shutdown properly

When the consumer does not complete execution in the SimpleMessageListenerContainer

shutdownTimeout

after AnnotationConfigApplicationContext.close()

call, my Spring application hangs.

LISTENER:

public class LongRunningMessageListener implements MessageListener {

    @Override
    public void onMessage(Message message) {
        System.out.println("Got " + new String(message.getBody()));
        try {
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            System.out.println("Interrupted");
            Thread.currentThread().interrupt();
        }
        System.out.println("Finished execution");
    }
}

      

Configuration:

@Configuration
public class Config {

    @Bean
    public MessageListenerContainer messageListenerContainer() {
        SimpleMessageListenerContainer messageListenerContainer = new SimpleMessageListenerContainer(connectionFactory());
        messageListenerContainer.setQueueNames("myqueue");
        messageListenerContainer.setMessageListener(new LongRunningMessageListener());
        messageListenerContainer.setShutdownTimeout(1000);
        return messageListenerContainer;
    }

    @Bean
    public ConnectionFactory connectionFactory() {
        return new CachingConnectionFactory("localhost");
    }
}

      

Main:

public static void main(String[] args) throws InterruptedException {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(Config.class);
    Thread.sleep(1000L);
    applicationContext.close();
}

      

Output:

 08, 2015 3:43:21 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1a86f2f1: startup date [Fri May 08 15:43:21 MSK 2015]; root of context hierarchy
 08, 2015 3:43:22 PM org.springframework.context.support.DefaultLifecycleProcessor start
INFO: Starting beans in phase 2147483647
 08, 2015 3:43:22 PM org.springframework.amqp.rabbit.connection.CachingConnectionFactory createBareConnection
INFO: Created new connection: SimpleConnection@4025f2f5 [delegate=amqp://guest@127.0.0.1:5672/]
Got foo1
 08, 2015 3:43:23 PM org.springframework.context.annotation.AnnotationConfigApplicationContext doClose
INFO: Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1a86f2f1: startup date [Fri May 08 15:43:21 MSK 2015]; root of context hierarchy
 08, 2015 3:43:23 PM org.springframework.context.support.DefaultLifecycleProcessor stop
INFO: Stopping beans in phase 2147483647
 08, 2015 3:43:23 PM org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer doShutdown
INFO: Waiting for workers to finish.
 08, 2015 3:43:24 PM org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer doShutdown
INFO: Workers not finished.  Forcing connections to close.
Finished execution
 08, 2015 3:43:27 PM org.springframework.amqp.rabbit.connection.CachingConnectionFactory createBareConnection
INFO: Created new connection: SimpleConnection@260da64e [delegate=amqp://guest@127.0.0.1:5672/]
 08, 2015 3:43:27 PM org.springframework.amqp.rabbit.connection.CachingConnectionFactory shutdownCompleted
SEVERE: Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)

      

After that, the application runs endlessly.

Worker threads:

Live threads: 14
Daemon threads: 10

      

Non-demons:

"pool-1-thread-10" #22 prio=5 os_prio=31 tid=0x00007fd48c93c800 nid=0x5a07 waiting on condition [0x0000000129eb3000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x0000000796333168> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
    - None

"pool-1-thread-9" #21 prio=5 os_prio=31 tid=0x00007fd48b9d8000 nid=0x540b waiting on condition [0x0000000129db0000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x000000079633dfb0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
    - None

"AMQP Connection 127.0.0.1:5672" #20 prio=5 os_prio=31 tid=0x00007fd48d186000 nid=0x530b runnable [0x0000000129cad000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:170)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
    - locked <0x000000079632e8f0> (a java.io.BufferedInputStream)
    at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288)
    at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
    at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:139)
    - locked <0x000000079632e8d0> (a java.io.DataInputStream)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:534)
    at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
    - None

"DestroyJavaVM" #19 prio=5 os_prio=31 tid=0x00007fd48d002000 nid=0x1303 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

      

It's okay if I increase shutdownTimeout

, but the timeout behavior looks like an error.

Spring versions:

spring-amqp 1.4.5.RELEASE
spring-rabbit 1.4.5.RELEASE
spring-context 4.1.5.RELEASE

      

Update : I replaced calls to System.out.println with Log

invocations and configured log4j for logging. Pattern:%r [%t] %-5p %c{1} - %m%n

Output:

0 [main] DEBUG StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
3 [main] DEBUG StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
4 [main] DEBUG StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
130 [main] INFO  AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@73a8dfcc: startup date [Fri May 08 17:07:06 MSK 2015]; root of context hierarchy
132 [main] DEBUG AnnotationConfigApplicationContext - Bean factory for org.springframework.context.annotation.AnnotationConfigApplicationContext@73a8dfcc: org.springframework.beans.factory.support.DefaultListableBeanFactory@1593948d: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,config]; root of factory hierarchy
178 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
179 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
232 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references
235 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
288 [main] DEBUG ConfigurationClassBeanDefinitionReader - Registering bean definition for @Bean method Config.messageListenerContainer()
288 [main] DEBUG ConfigurationClassBeanDefinitionReader - Registering bean definition for @Bean method Config.connectionFactory()
431 [main] DEBUG ConfigurationClassEnhancer - Successfully enhanced Config; enhanced class name is: Config$$EnhancerBySpringCGLIB$$b6627e0a
432 [main] DEBUG ConfigurationClassPostProcessor - Replacing bean definition 'config' existing class name 'Config' with enhanced class name 'Config$$EnhancerBySpringCGLIB$$b6627e0a'
436 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
436 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
438 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
438 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
438 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
438 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
439 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
439 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
439 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
439 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
445 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
445 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
445 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
445 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
445 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references
446 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
446 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
446 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
446 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references
446 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
450 [main] DEBUG AnnotationConfigApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@27d415d9]
454 [main] DEBUG AnnotationConfigApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@b3d7190]
461 [main] DEBUG DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1593948d: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,config,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,messageListenerContainer,connectionFactory]; root of factory hierarchy
461 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
462 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
462 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
462 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
462 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'config'
463 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'config'
468 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'config' to allow for resolving potential circular references
494 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'config'
494 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor'
494 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor'
494 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'messageListenerContainer'
495 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'messageListenerContainer'
497 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'config'
551 [main] DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'connectionFactory'
551 [main] DEBUG DefaultListableBeanFactory - Creating instance of bean 'connectionFactory'
552 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'config'
595 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'connectionFactory' to allow for resolving potential circular references
609 [main] DEBUG DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'connectionFactory'
609 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'connectionFactory'
638 [main] DEBUG DefaultListableBeanFactory - Eagerly caching bean 'messageListenerContainer' to allow for resolving potential circular references
707 [main] DEBUG DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'messageListenerContainer'
708 [main] DEBUG SimpleMessageListenerContainer - No global properties bean
708 [main] DEBUG DefaultListableBeanFactory - Finished creating instance of bean 'messageListenerContainer'
708 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'connectionFactory'
710 [main] DEBUG AnnotationConfigApplicationContext - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@b62fe6d]
710 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'messageListenerContainer'
710 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
716 [main] INFO  DefaultLifecycleProcessor - Starting beans in phase 2147483647
716 [main] DEBUG DefaultLifecycleProcessor - Starting bean 'messageListenerContainer' of type [class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer]
716 [main] DEBUG SimpleMessageListenerContainer - No global properties bean
716 [main] DEBUG SimpleMessageListenerContainer - Starting Rabbit listener container.
767 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Starting consumer Consumer: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
852 [SimpleAsyncTaskExecutor-1] INFO  CachingConnectionFactory - Created new connection: SimpleConnection@25c0a36 [delegate=amqp://guest@127.0.0.1:5672/]
869 [SimpleAsyncTaskExecutor-1] DEBUG CachingConnectionFactory - Creating cached Rabbit Channel from AMQChannel(amqp://guest@127.0.0.1:5672/,1)
911 [pool-1-thread-3] DEBUG BlockingQueueConsumer - ConsumeOK : Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
914 [pool-1-thread-4] DEBUG BlockingQueueConsumer - Storing delivery for Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
915 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Started on queue 'myqueue' with tag amq.ctag-KkQJOq3Z0r8Uc0JwcKdGxQ: Consumer: tags=[{amq.ctag-KkQJOq3Z0r8Uc0JwcKdGxQ=myqueue}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=1
916 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Retrieving delivery for Consumer: tags=[{amq.ctag-KkQJOq3Z0r8Uc0JwcKdGxQ=myqueue}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=1
920 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Received message: (Body:'foo5'MessageProperties [headers={}, timestamp=null, messageId=null, userId=null, appId=null, clusterId=null, type=null, correlationId=null, replyTo=null, contentType=text/plain, contentEncoding=UTF-8, contentLength=0, deliveryMode=PERSISTENT, expiration=null, priority=0, redelivered=true, receivedExchange=, receivedRoutingKey=myqueue, deliveryTag=1, messageCount=0])
921 [SimpleAsyncTaskExecutor-1] INFO  LongRunningMessageListener - Got foo5
921 [main] DEBUG DefaultLifecycleProcessor - Successfully started bean 'messageListenerContainer'
931 [main] DEBUG PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
932 [main] DEBUG PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
933 [main] DEBUG PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
1938 [main] INFO  AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@73a8dfcc: startup date [Fri May 08 17:07:06 MSK 2015]; root of context hierarchy
1938 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'messageListenerContainer'
1938 [main] DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
1939 [main] INFO  DefaultLifecycleProcessor - Stopping beans in phase 2147483647
1939 [main] DEBUG DefaultLifecycleProcessor - Asking bean 'messageListenerContainer' of type [class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer] to stop
1939 [main] DEBUG SimpleMessageListenerContainer - Shutting down Rabbit listener container
1941 [main] INFO  SimpleMessageListenerContainer - Waiting for workers to finish.
1941 [pool-1-thread-5] DEBUG BlockingQueueConsumer - Received cancellation notice for tag amq.ctag-KkQJOq3Z0r8Uc0JwcKdGxQ; Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
2946 [main] INFO  SimpleMessageListenerContainer - Workers not finished.  Forcing connections to close.
2946 [main] DEBUG DefaultLifecycleProcessor - Bean 'messageListenerContainer' completed its stop procedure
2946 [main] DEBUG DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1593948d: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,config,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,messageListenerContainer,connectionFactory]; root of factory hierarchy
2946 [main] DEBUG DisposableBeanAdapter - Invoking destroy() on bean with name 'messageListenerContainer'
2946 [main] DEBUG SimpleMessageListenerContainer - Shutting down Rabbit listener container
2946 [main] DEBUG DisposableBeanAdapter - Invoking destroy() on bean with name 'connectionFactory'
5923 [SimpleAsyncTaskExecutor-1] INFO  LongRunningMessageListener - Finished execution
5927 [SimpleAsyncTaskExecutor-1] INFO  CachingConnectionFactory - Created new connection: SimpleConnection@5d0224dc [delegate=amqp://guest@127.0.0.1:5672/]
5928 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Retrieving delivery for Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
5929 [AMQP Connection 127.0.0.1:5672] ERROR CachingConnectionFactory - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
6932 [SimpleAsyncTaskExecutor-1] DEBUG SimpleMessageListenerContainer - Cancelling Consumer: tags=[{}], channel=Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1), acknowledgeMode=AUTO local queue size=0
6933 [SimpleAsyncTaskExecutor-1] DEBUG BlockingQueueConsumer - Closing Rabbit Channel: Cached Rabbit Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1)
6933 [SimpleAsyncTaskExecutor-1] DEBUG CachingConnectionFactory - Closing cached Channel: AMQChannel(amqp://guest@127.0.0.1:5672/,1)

      

+3


source to share


1 answer


Regarding your comment on the question (in response to @Artem's work) ...

I tried this solution too. It works for this simple case (Thread.sleep ()), but doesn't work when the listener is doing a "real" job with the long awaited IO, for example.



The infrastructure cannot do anything if the user code is in an uninterruptible power state, such as waiting for socket I / O. You need to close the socket somehow.

0


source







All Articles