Commit 21a0957
authored
[event-hubs] fixes issue where processEvents ignores maxWaitTime after retryable disconnect event (Azure#12280)
Fixes Azure#12278
## Description
This PR adds a check within the `PartitionPump`'s receive events loop to determine whether the receiver has been closed. If the receiver has been closed, it will create a new receiver using an event start position that matches the last event seen by the pump.
The receiver is explicitly closed when a disconnected event is received on the underlying AMQP connection, which causes calls to `receiveBatch` to immediately return any events it had collected up to this point. Note that once the receiver is closed, the receiver's onAmqpMessage handler is removed so it won't receive any additional events.
## Updates to testing
I manually tested the changes in this PR against the sample code in the linked issue.
I also updated the existing `disconnect` test to confirm that
- the `maxWaitTimeInSeconds` is honoured after a disconnected event is encountered.
- new events can be received on subsequent `processEvents` invocations.1 parent e734672 commit 21a0957
File tree
4 files changed
+123
-15
lines changed- sdk/eventhub/event-hubs
- src
- test/node
4 files changed
+123
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
63 | 85 | | |
64 | 86 | | |
65 | 87 | | |
66 | 88 | | |
67 | | - | |
| 89 | + | |
68 | 90 | | |
69 | 91 | | |
70 | 92 | | |
71 | 93 | | |
72 | 94 | | |
73 | 95 | | |
74 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
75 | 104 | | |
76 | 105 | | |
77 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
78 | 112 | | |
79 | 113 | | |
80 | 114 | | |
81 | 115 | | |
82 | 116 | | |
83 | 117 | | |
84 | 118 | | |
85 | | - | |
| 119 | + | |
86 | 120 | | |
87 | | - | |
| 121 | + | |
| 122 | + | |
88 | 123 | | |
89 | 124 | | |
90 | 125 | | |
91 | 126 | | |
92 | 127 | | |
93 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
94 | 133 | | |
95 | 134 | | |
96 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
57 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
58 | 76 | | |
59 | | - | |
60 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
61 | 82 | | |
62 | 83 | | |
63 | 84 | | |
64 | 85 | | |
| 86 | + | |
| 87 | + | |
65 | 88 | | |
66 | | - | |
| 89 | + | |
67 | 90 | | |
68 | 91 | | |
69 | 92 | | |
| 93 | + | |
70 | 94 | | |
71 | | - | |
72 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
73 | 103 | | |
74 | 104 | | |
75 | 105 | | |
76 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
77 | 133 | | |
78 | 134 | | |
79 | 135 | | |
| |||
84 | 140 | | |
85 | 141 | | |
86 | 142 | | |
87 | | - | |
88 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
89 | 147 | | |
90 | 148 | | |
91 | 149 | | |
92 | 150 | | |
93 | | - | |
| 151 | + | |
| 152 | + | |
94 | 153 | | |
95 | 154 | | |
96 | 155 | | |
| |||
0 commit comments