You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-cloud-gcp-pubsub/src/main/java/org/springframework/cloud/gcp/pubsub/integration/inbound/PubSubInboundChannelAdapter.java
+4-8Lines changed: 4 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -145,26 +145,22 @@ public void nack() {
145
145
});
146
146
}
147
147
148
-
booleanmessageNacked = false;
149
-
150
148
try {
151
149
sendMessage(getMessageBuilderFactory()
152
150
.withPayload(message.getPayload())
153
151
.copyHeaders(messageHeaders)
154
152
.build());
153
+
154
+
if (this.ackMode == AckMode.AUTO_ACK || this.ackMode == AckMode.AUTO) {
155
+
message.ack();
156
+
}
155
157
}
156
158
catch (RuntimeExceptionre) {
157
159
if (this.ackMode == AckMode.AUTO) {
158
160
message.nack();
159
-
messageNacked = true;
160
161
}
161
162
thrownewPubSubException("Sending Spring message failed.", re);
Copy file name to clipboardExpand all lines: spring-cloud-gcp-pubsub/src/test/java/org/springframework/cloud/gcp/pubsub/integration/inbound/PubSubInboundChannelAdapterTests.java
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -128,6 +128,8 @@ public void testAckModeAutoAck_nacksWhenDownstreamProcessingFails() {
128
128
this.adapter.start();
129
129
}).hasMessageContaining(EXCEPTION_MESSAGE);
130
130
131
+
// When exception thrown, verify that neither ack() nor nack() is called.
0 commit comments