Commit 419b886
DATAGO-134580: Recreate JCSMP producer on unsolicited CloseFlow
Backport of PR SolaceProducts#475 (SolaceProducts) / commits 931f09c..ee61040 on
master to stage-4.11.1.
When the broker fans out an unsolicited CloseFlow on a publisher flow
(message-spool maintenance, DR failover, "503: Service Unavailable" on
GD), JCSMP marks the per-binding XMLMessageProducer terminally closed.
The JCSMP session stays connected, but every subsequent producer.send
throws StaleSessionException until the application is restarted.
Outbound handler (JCSMPOutboundMessageHandler):
- New volatile recreateProducer flag + lifecycleLock that covers
start(), stop(), closeResources(), createProducerInternal(), and
recreateProducerIfNeeded().
- Catch arm in handleMessage detects StaleSessionException /
JCSMPTransportException / ClosedFacilityException (and a closed
producer post-send), arms the flag, and surfaces the original
exception via the error channel.
- Pre-check at the top of every handleMessage rebuilds the producer
proactively when producer.isClosed() returns true.
- createProducerInternal is now self-contained: locks, gets the
shared session-default producer from JCSMPSessionProducerManager,
creates the per-binding producer (+ transacted session when
configured), and on failure closes whatever was partially built and
wraps in a RuntimeException.
- Recreate failure stays armed so the next inbound message retries.
Shared producer manager:
- JCSMPSessionProducerManager.forceRecreate(expected) added. CAS
semantics: only recreates if the manager still holds the supplied
reference; otherwise returns the currently-installed one.
Error-queue path (ErrorQueueInfrastructure):
- Proactive isClosed() check on the shared session-default producer
before send.
- Reactive forceRecreate(observed) on stale-flow / transport / closed
send exceptions. Recovery is single-shot here because
ErrorQueueRepublishCorrelationKey.handleError() already loops up to
errorQueueMaxDeliveryAttempts.
Tests:
- Unit (JCSMPOutboundMessageHandlerTest, ErrorQueueInfrastructureTest):
Cartesian coverage over transacted x stale-flow exception type for
the recovery paths; proactive isClosed pre-check; recreate-failure
retry; stop/start flag-reset; CAS noop for forceRecreate.
- Broker IT (JCSMPProducerCloseFlowRecoveryIT, new): three control
scenarios that document broker disruptions which do NOT reproduce
the bug (spool-quota toggle on persistent topic, direct topic,
queue ingress/egress toggle), plus the customer-reported reproducer
driven via broker CLI (hardware message-spool shutdown over docker
exec with TTY for confirmation prompts) and a repeated-cycles
variant. Container is selected by SMF host port to avoid targeting
leftover containers. After re-enable, the test waits for JCSMP's
PUB_GUARANTEED capability to refresh before driving recovery
publishes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3748ade commit 419b886
8 files changed
Lines changed: 975 additions & 42 deletions
File tree
- solace-spring-cloud-stream-binder
- solace-spring-cloud-stream-binder-core/src
- main/java/com/solace/spring/cloud/stream/binder
- outbound
- util
- test/java/com/solace/spring/cloud/stream/binder
- outbound
- util
- solace-spring-cloud-stream-binder/src/test/java/com/solace
- it/util/semp/config
- spring/cloud/stream/binder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 102 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
| |||
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| 105 | + | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
| |||
165 | 174 | | |
166 | 175 | | |
167 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
| |||
229 | 250 | | |
230 | 251 | | |
231 | 252 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
235 | 280 | | |
| 281 | + | |
236 | 282 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
247 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
248 | 301 | | |
| 302 | + | |
| 303 | + | |
249 | 304 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
259 | 312 | | |
260 | | - | |
261 | | - | |
262 | | - | |
| 313 | + | |
| 314 | + | |
263 | 315 | | |
264 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
265 | 324 | | |
266 | | - | |
267 | | - | |
268 | 325 | | |
269 | 326 | | |
270 | 327 | | |
271 | 328 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
275 | 334 | | |
276 | 335 | | |
277 | 336 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
286 | 349 | | |
287 | | - | |
288 | 350 | | |
289 | 351 | | |
290 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
46 | 72 | | |
47 | 73 | | |
48 | 74 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
46 | 72 | | |
47 | 73 | | |
48 | 74 | | |
| |||
0 commit comments