|
65 | 65 | */
|
66 | 66 | public class AmqpInboundGateway extends MessagingGatewaySupport {
|
67 | 67 |
|
68 |
| - private static final ThreadLocal<AttributeAccessor> attributesHolder = new ThreadLocal<AttributeAccessor>(); |
| 68 | + private static final ThreadLocal<AttributeAccessor> attributesHolder = new ThreadLocal<>(); |
69 | 69 |
|
70 | 70 | private final AbstractMessageListenerContainer messageListenerContainer;
|
71 | 71 |
|
@@ -208,11 +208,13 @@ protected void onInit() throws Exception {
|
208 | 208 |
|
209 | 209 | @Override
|
210 | 210 | protected void doStart() {
|
| 211 | + super.doStart(); |
211 | 212 | this.messageListenerContainer.start();
|
212 | 213 | }
|
213 | 214 |
|
214 | 215 | @Override
|
215 | 216 | protected void doStop() {
|
| 217 | + super.doStop(); |
216 | 218 | this.messageListenerContainer.stop();
|
217 | 219 | }
|
218 | 220 |
|
@@ -271,11 +273,11 @@ public void onMessage(final Message message, final Channel channel) throws Excep
|
271 | 273 | org.springframework.messaging.Message<Object> converted = convert(message, channel);
|
272 | 274 | if (converted != null) {
|
273 | 275 | AmqpInboundGateway.this.retryTemplate.execute(context -> {
|
274 |
| - StaticMessageHeaderAccessor.getDeliveryAttempt(converted).incrementAndGet(); |
275 |
| - process(message, converted); |
276 |
| - return null; |
277 |
| - }, |
278 |
| - (RecoveryCallback<Object>) AmqpInboundGateway.this.recoveryCallback); |
| 276 | + StaticMessageHeaderAccessor.getDeliveryAttempt(converted).incrementAndGet(); |
| 277 | + process(message, converted); |
| 278 | + return null; |
| 279 | + }, |
| 280 | + (RecoveryCallback<Object>) AmqpInboundGateway.this.recoveryCallback); |
279 | 281 | }
|
280 | 282 | }
|
281 | 283 | }
|
@@ -305,9 +307,9 @@ private org.springframework.messaging.Message<Object> convert(Message message, C
|
305 | 307 | return null;
|
306 | 308 | }
|
307 | 309 | return getMessageBuilderFactory()
|
308 |
| - .withPayload(payload) |
309 |
| - .copyHeaders(headers) |
310 |
| - .build(); |
| 310 | + .withPayload(payload) |
| 311 | + .copyHeaders(headers) |
| 312 | + .build(); |
311 | 313 | }
|
312 | 314 |
|
313 | 315 | private void process(Message message, org.springframework.messaging.Message<Object> messagingMessage) {
|
|
0 commit comments