|
1 | 1 | /*
|
2 |
| - * Copyright 2014-2017 the original author or authors. |
| 2 | + * Copyright 2014-2018 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
38 | 38 | import org.springframework.context.ConfigurableApplicationContext;
|
39 | 39 | import org.springframework.context.SmartLifecycle;
|
40 | 40 | import org.springframework.context.event.ContextRefreshedEvent;
|
| 41 | +import org.springframework.lang.Nullable; |
41 | 42 | import org.springframework.util.Assert;
|
42 | 43 | import org.springframework.util.StringUtils;
|
43 | 44 |
|
@@ -141,7 +142,7 @@ public void registerListenerContainer(RabbitListenerEndpoint endpoint, RabbitLis
|
141 | 142 | */
|
142 | 143 | @SuppressWarnings("unchecked")
|
143 | 144 | public void registerListenerContainer(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> factory,
|
144 |
| - boolean startImmediately) { |
| 145 | + boolean startImmediately) { |
145 | 146 | Assert.notNull(endpoint, "Endpoint must not be null");
|
146 | 147 | Assert.notNull(factory, "Factory must not be null");
|
147 | 148 |
|
@@ -201,6 +202,16 @@ protected MessageListenerContainer createListenerContainer(RabbitListenerEndpoin
|
201 | 202 | return listenerContainer;
|
202 | 203 | }
|
203 | 204 |
|
| 205 | + /** |
| 206 | + * Remove a listener container from the registry. |
| 207 | + * @param id the container id. |
| 208 | + * @return the container, or null if there is no registration matching the id. |
| 209 | + * @since 2.0.6 |
| 210 | + */ |
| 211 | + @Nullable |
| 212 | + public MessageListenerContainer unregisterListenerContainer(String id) { |
| 213 | + return this.listenerContainers.remove(id); |
| 214 | + } |
204 | 215 |
|
205 | 216 | @Override
|
206 | 217 | public void destroy() {
|
|
0 commit comments