From 8d2b278c9339223b7169e97b4d77d49b5a4edb8a Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 10 Nov 2015 09:47:51 -0500 Subject: [PATCH] Fix Stomp Test Race Condition Message producers are started in phase `Integer.MAX_INT / 2`. The test case has a stomp inbound adapter and an event producer. Since they are both in the same phase, the event producer can miss the `StompReceiptEvent`. Change the phase of the event producer to ensure it is started before other message producers. (cherry picked from commit 1107bfa) --- .../inbound/ApplicationEventListeningMessageProducer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java index cf6580c397..63062524da 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java @@ -56,6 +56,10 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP private volatile long stoppedAt; + public ApplicationEventListeningMessageProducer() { + setPhase(Integer.MAX_VALUE / 2 - 1000); + } + /** * Set the list of event types (classes that extend ApplicationEvent) that * this adapter should send to the message channel. By default, all event