karafka 2.5.8 → 2.5.10.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/LICENSE-COMM +4 -2
  4. data/certs/expired.txt +83 -0
  5. data/config/locales/errors.yml +3 -0
  6. data/config/locales/pro_errors.yml +1 -0
  7. data/karafka.gemspec +2 -2
  8. data/lib/karafka/admin/replication.rb +36 -4
  9. data/lib/karafka/connection/client.rb +7 -1
  10. data/lib/karafka/connection/listener.rb +2 -1
  11. data/lib/karafka/helpers/interval_runner.rb +2 -2
  12. data/lib/karafka/instrumentation/assignments_tracker.rb +65 -2
  13. data/lib/karafka/instrumentation/logger_listener.rb +19 -0
  14. data/lib/karafka/instrumentation/notifications.rb +2 -0
  15. data/lib/karafka/instrumentation/vendors/appsignal/metrics_listener.rb +1 -3
  16. data/lib/karafka/instrumentation/vendors/datadog/metrics_listener.rb +1 -1
  17. data/lib/karafka/instrumentation/vendors/kubernetes/liveness_listener.rb +13 -10
  18. data/lib/karafka/pro/active_job/consumer.rb +8 -0
  19. data/lib/karafka/pro/active_job/dispatcher.rb +8 -0
  20. data/lib/karafka/pro/active_job/job_options_contract.rb +8 -0
  21. data/lib/karafka/pro/admin/recovery/errors.rb +8 -0
  22. data/lib/karafka/pro/admin/recovery.rb +8 -0
  23. data/lib/karafka/pro/base_consumer.rb +8 -0
  24. data/lib/karafka/pro/cleaner/errors.rb +8 -0
  25. data/lib/karafka/pro/cleaner/messages/message.rb +8 -0
  26. data/lib/karafka/pro/cleaner/messages/messages.rb +8 -0
  27. data/lib/karafka/pro/cleaner/messages/metadata.rb +8 -0
  28. data/lib/karafka/pro/cleaner.rb +8 -0
  29. data/lib/karafka/pro/cli/contracts/server.rb +8 -0
  30. data/lib/karafka/pro/cli/parallel_segments/base.rb +8 -0
  31. data/lib/karafka/pro/cli/parallel_segments/collapse.rb +8 -0
  32. data/lib/karafka/pro/cli/parallel_segments/distribute.rb +8 -0
  33. data/lib/karafka/pro/cli/parallel_segments.rb +8 -0
  34. data/lib/karafka/pro/cli/topics/health.rb +8 -0
  35. data/lib/karafka/pro/cli/topics.rb +8 -0
  36. data/lib/karafka/pro/connection/manager.rb +8 -0
  37. data/lib/karafka/pro/connection/multiplexing/listener.rb +8 -0
  38. data/lib/karafka/pro/contracts/base.rb +8 -0
  39. data/lib/karafka/pro/encryption/cipher.rb +8 -0
  40. data/lib/karafka/pro/encryption/contracts/config.rb +8 -0
  41. data/lib/karafka/pro/encryption/errors.rb +8 -0
  42. data/lib/karafka/pro/encryption/messages/middleware.rb +8 -0
  43. data/lib/karafka/pro/encryption/messages/parser.rb +8 -0
  44. data/lib/karafka/pro/encryption/setup/config.rb +8 -0
  45. data/lib/karafka/pro/encryption.rb +8 -0
  46. data/lib/karafka/pro/instrumentation/performance_tracker.rb +8 -0
  47. data/lib/karafka/pro/iterator/expander.rb +8 -0
  48. data/lib/karafka/pro/iterator/tpl_builder.rb +8 -0
  49. data/lib/karafka/pro/iterator.rb +8 -0
  50. data/lib/karafka/pro/loader.rb +10 -0
  51. data/lib/karafka/pro/processing/adaptive_iterator/consumer.rb +8 -0
  52. data/lib/karafka/pro/processing/adaptive_iterator/tracker.rb +8 -0
  53. data/lib/karafka/pro/processing/collapser.rb +8 -0
  54. data/lib/karafka/pro/processing/coordinator.rb +8 -0
  55. data/lib/karafka/pro/processing/coordinators/errors_tracker.rb +8 -0
  56. data/lib/karafka/pro/processing/coordinators/filters_applier.rb +8 -0
  57. data/lib/karafka/pro/processing/coordinators/virtual_offset_manager.rb +8 -0
  58. data/lib/karafka/pro/processing/executor.rb +8 -0
  59. data/lib/karafka/pro/processing/expansions_selector.rb +8 -0
  60. data/lib/karafka/pro/processing/filters/base.rb +8 -0
  61. data/lib/karafka/pro/processing/filters/delayer.rb +8 -0
  62. data/lib/karafka/pro/processing/filters/expirer.rb +8 -0
  63. data/lib/karafka/pro/processing/filters/inline_insights_delayer.rb +8 -0
  64. data/lib/karafka/pro/processing/filters/throttler.rb +8 -0
  65. data/lib/karafka/pro/processing/filters/virtual_limiter.rb +8 -0
  66. data/lib/karafka/pro/processing/jobs/consume_non_blocking.rb +8 -0
  67. data/lib/karafka/pro/processing/jobs/eofed_non_blocking.rb +8 -0
  68. data/lib/karafka/pro/processing/jobs/periodic.rb +8 -0
  69. data/lib/karafka/pro/processing/jobs/periodic_non_blocking.rb +8 -0
  70. data/lib/karafka/pro/processing/jobs/revoked_non_blocking.rb +8 -0
  71. data/lib/karafka/pro/processing/jobs_builder.rb +8 -0
  72. data/lib/karafka/pro/processing/jobs_queue.rb +8 -0
  73. data/lib/karafka/pro/processing/offset_metadata/consumer.rb +8 -0
  74. data/lib/karafka/pro/processing/offset_metadata/fetcher.rb +8 -0
  75. data/lib/karafka/pro/processing/offset_metadata/listener.rb +8 -0
  76. data/lib/karafka/pro/processing/parallel_segments/filters/base.rb +8 -0
  77. data/lib/karafka/pro/processing/parallel_segments/filters/default.rb +8 -0
  78. data/lib/karafka/pro/processing/parallel_segments/filters/mom.rb +8 -0
  79. data/lib/karafka/pro/processing/partitioner.rb +8 -0
  80. data/lib/karafka/pro/processing/periodic_job/consumer.rb +8 -0
  81. data/lib/karafka/pro/processing/piping/consumer.rb +8 -0
  82. data/lib/karafka/pro/processing/schedulers/base.rb +8 -0
  83. data/lib/karafka/pro/processing/schedulers/default.rb +8 -0
  84. data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_lrj_mom.rb +8 -0
  85. data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_lrj_mom_vp.rb +8 -0
  86. data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_mom.rb +8 -0
  87. data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_mom_vp.rb +8 -0
  88. data/lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom.rb +8 -0
  89. data/lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom_vp.rb +8 -0
  90. data/lib/karafka/pro/processing/strategies/aj/dlq_mom.rb +8 -0
  91. data/lib/karafka/pro/processing/strategies/aj/dlq_mom_vp.rb +8 -0
  92. data/lib/karafka/pro/processing/strategies/aj/ftr_lrj_mom.rb +8 -0
  93. data/lib/karafka/pro/processing/strategies/aj/ftr_lrj_mom_vp.rb +8 -0
  94. data/lib/karafka/pro/processing/strategies/aj/ftr_mom.rb +8 -0
  95. data/lib/karafka/pro/processing/strategies/aj/ftr_mom_vp.rb +8 -0
  96. data/lib/karafka/pro/processing/strategies/aj/lrj_mom.rb +8 -0
  97. data/lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb +8 -0
  98. data/lib/karafka/pro/processing/strategies/aj/mom.rb +8 -0
  99. data/lib/karafka/pro/processing/strategies/aj/mom_vp.rb +8 -0
  100. data/lib/karafka/pro/processing/strategies/base.rb +8 -0
  101. data/lib/karafka/pro/processing/strategies/default.rb +8 -0
  102. data/lib/karafka/pro/processing/strategies/dlq/default.rb +8 -0
  103. data/lib/karafka/pro/processing/strategies/dlq/ftr.rb +8 -0
  104. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj.rb +8 -0
  105. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom.rb +8 -0
  106. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom_vp.rb +8 -0
  107. data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_vp.rb +8 -0
  108. data/lib/karafka/pro/processing/strategies/dlq/ftr_mom.rb +8 -0
  109. data/lib/karafka/pro/processing/strategies/dlq/ftr_mom_vp.rb +8 -0
  110. data/lib/karafka/pro/processing/strategies/dlq/ftr_vp.rb +8 -0
  111. data/lib/karafka/pro/processing/strategies/dlq/lrj.rb +8 -0
  112. data/lib/karafka/pro/processing/strategies/dlq/lrj_mom.rb +8 -0
  113. data/lib/karafka/pro/processing/strategies/dlq/lrj_mom_vp.rb +8 -0
  114. data/lib/karafka/pro/processing/strategies/dlq/lrj_vp.rb +8 -0
  115. data/lib/karafka/pro/processing/strategies/dlq/mom.rb +8 -0
  116. data/lib/karafka/pro/processing/strategies/dlq/mom_vp.rb +8 -0
  117. data/lib/karafka/pro/processing/strategies/dlq/vp.rb +8 -0
  118. data/lib/karafka/pro/processing/strategies/ftr/default.rb +8 -0
  119. data/lib/karafka/pro/processing/strategies/ftr/vp.rb +8 -0
  120. data/lib/karafka/pro/processing/strategies/lrj/default.rb +8 -0
  121. data/lib/karafka/pro/processing/strategies/lrj/ftr.rb +8 -0
  122. data/lib/karafka/pro/processing/strategies/lrj/ftr_mom.rb +8 -0
  123. data/lib/karafka/pro/processing/strategies/lrj/ftr_mom_vp.rb +8 -0
  124. data/lib/karafka/pro/processing/strategies/lrj/ftr_vp.rb +8 -0
  125. data/lib/karafka/pro/processing/strategies/lrj/mom.rb +8 -0
  126. data/lib/karafka/pro/processing/strategies/lrj/mom_vp.rb +8 -0
  127. data/lib/karafka/pro/processing/strategies/lrj/vp.rb +8 -0
  128. data/lib/karafka/pro/processing/strategies/mom/default.rb +8 -0
  129. data/lib/karafka/pro/processing/strategies/mom/ftr.rb +8 -0
  130. data/lib/karafka/pro/processing/strategies/mom/ftr_vp.rb +8 -0
  131. data/lib/karafka/pro/processing/strategies/mom/vp.rb +8 -0
  132. data/lib/karafka/pro/processing/strategies/vp/default.rb +8 -0
  133. data/lib/karafka/pro/processing/strategies.rb +8 -0
  134. data/lib/karafka/pro/processing/strategy_selector.rb +8 -0
  135. data/lib/karafka/pro/processing/subscription_groups_coordinator.rb +8 -0
  136. data/lib/karafka/pro/processing/virtual_partitions/distributors/balanced.rb +8 -0
  137. data/lib/karafka/pro/processing/virtual_partitions/distributors/base.rb +8 -0
  138. data/lib/karafka/pro/processing/virtual_partitions/distributors/consistent.rb +8 -0
  139. data/lib/karafka/pro/recurring_tasks/consumer.rb +8 -0
  140. data/lib/karafka/pro/recurring_tasks/contracts/config.rb +8 -0
  141. data/lib/karafka/pro/recurring_tasks/contracts/task.rb +8 -0
  142. data/lib/karafka/pro/recurring_tasks/deserializer.rb +8 -0
  143. data/lib/karafka/pro/recurring_tasks/dispatcher.rb +8 -0
  144. data/lib/karafka/pro/recurring_tasks/errors.rb +8 -0
  145. data/lib/karafka/pro/recurring_tasks/executor.rb +8 -0
  146. data/lib/karafka/pro/recurring_tasks/listener.rb +8 -0
  147. data/lib/karafka/pro/recurring_tasks/matcher.rb +8 -0
  148. data/lib/karafka/pro/recurring_tasks/schedule.rb +8 -0
  149. data/lib/karafka/pro/recurring_tasks/serializer.rb +8 -0
  150. data/lib/karafka/pro/recurring_tasks/setup/config.rb +8 -0
  151. data/lib/karafka/pro/recurring_tasks/task.rb +8 -0
  152. data/lib/karafka/pro/recurring_tasks.rb +8 -0
  153. data/lib/karafka/pro/routing/features/active_job/builder.rb +8 -0
  154. data/lib/karafka/pro/routing/features/active_job.rb +8 -0
  155. data/lib/karafka/pro/routing/features/adaptive_iterator/config.rb +8 -0
  156. data/lib/karafka/pro/routing/features/adaptive_iterator/contracts/topic.rb +8 -0
  157. data/lib/karafka/pro/routing/features/adaptive_iterator/topic.rb +8 -0
  158. data/lib/karafka/pro/routing/features/adaptive_iterator.rb +8 -0
  159. data/lib/karafka/pro/routing/features/base.rb +8 -0
  160. data/lib/karafka/pro/routing/features/dead_letter_queue/contracts/topic.rb +8 -0
  161. data/lib/karafka/pro/routing/features/dead_letter_queue/topic.rb +8 -0
  162. data/lib/karafka/pro/routing/features/dead_letter_queue.rb +8 -0
  163. data/lib/karafka/pro/routing/features/delaying/config.rb +8 -0
  164. data/lib/karafka/pro/routing/features/delaying/contracts/topic.rb +8 -0
  165. data/lib/karafka/pro/routing/features/delaying/topic.rb +8 -0
  166. data/lib/karafka/pro/routing/features/delaying.rb +8 -0
  167. data/lib/karafka/pro/routing/features/direct_assignments/config.rb +8 -0
  168. data/lib/karafka/pro/routing/features/direct_assignments/contracts/consumer_group.rb +8 -0
  169. data/lib/karafka/pro/routing/features/direct_assignments/contracts/topic.rb +8 -0
  170. data/lib/karafka/pro/routing/features/direct_assignments/subscription_group.rb +8 -0
  171. data/lib/karafka/pro/routing/features/direct_assignments/topic.rb +8 -0
  172. data/lib/karafka/pro/routing/features/direct_assignments.rb +8 -0
  173. data/lib/karafka/pro/routing/features/expiring/config.rb +8 -0
  174. data/lib/karafka/pro/routing/features/expiring/contracts/topic.rb +8 -0
  175. data/lib/karafka/pro/routing/features/expiring/topic.rb +8 -0
  176. data/lib/karafka/pro/routing/features/expiring.rb +8 -0
  177. data/lib/karafka/pro/routing/features/filtering/config.rb +8 -0
  178. data/lib/karafka/pro/routing/features/filtering/contracts/topic.rb +8 -0
  179. data/lib/karafka/pro/routing/features/filtering/topic.rb +8 -0
  180. data/lib/karafka/pro/routing/features/filtering.rb +8 -0
  181. data/lib/karafka/pro/routing/features/inline_insights/config.rb +8 -0
  182. data/lib/karafka/pro/routing/features/inline_insights/contracts/topic.rb +8 -0
  183. data/lib/karafka/pro/routing/features/inline_insights/topic.rb +8 -0
  184. data/lib/karafka/pro/routing/features/inline_insights.rb +8 -0
  185. data/lib/karafka/pro/routing/features/long_running_job/config.rb +8 -0
  186. data/lib/karafka/pro/routing/features/long_running_job/contracts/topic.rb +8 -0
  187. data/lib/karafka/pro/routing/features/long_running_job/topic.rb +8 -0
  188. data/lib/karafka/pro/routing/features/long_running_job.rb +8 -0
  189. data/lib/karafka/pro/routing/features/multiplexing/config.rb +8 -0
  190. data/lib/karafka/pro/routing/features/multiplexing/contracts/routing.rb +81 -0
  191. data/lib/karafka/pro/routing/features/multiplexing/contracts/topic.rb +8 -0
  192. data/lib/karafka/pro/routing/features/multiplexing/patches/contracts/consumer_group.rb +8 -0
  193. data/lib/karafka/pro/routing/features/multiplexing/proxy.rb +8 -0
  194. data/lib/karafka/pro/routing/features/multiplexing/subscription_group.rb +8 -0
  195. data/lib/karafka/pro/routing/features/multiplexing/subscription_groups_builder.rb +8 -0
  196. data/lib/karafka/pro/routing/features/multiplexing.rb +17 -2
  197. data/lib/karafka/pro/routing/features/non_blocking_job/topic.rb +8 -0
  198. data/lib/karafka/pro/routing/features/non_blocking_job.rb +8 -0
  199. data/lib/karafka/pro/routing/features/offset_metadata/config.rb +8 -0
  200. data/lib/karafka/pro/routing/features/offset_metadata/contracts/topic.rb +8 -0
  201. data/lib/karafka/pro/routing/features/offset_metadata/topic.rb +8 -0
  202. data/lib/karafka/pro/routing/features/offset_metadata.rb +8 -0
  203. data/lib/karafka/pro/routing/features/parallel_segments/builder.rb +8 -0
  204. data/lib/karafka/pro/routing/features/parallel_segments/config.rb +8 -0
  205. data/lib/karafka/pro/routing/features/parallel_segments/consumer_group.rb +8 -0
  206. data/lib/karafka/pro/routing/features/parallel_segments/contracts/consumer_group.rb +8 -0
  207. data/lib/karafka/pro/routing/features/parallel_segments/topic.rb +8 -0
  208. data/lib/karafka/pro/routing/features/parallel_segments.rb +8 -0
  209. data/lib/karafka/pro/routing/features/patterns/builder.rb +8 -0
  210. data/lib/karafka/pro/routing/features/patterns/config.rb +8 -0
  211. data/lib/karafka/pro/routing/features/patterns/consumer_group.rb +8 -0
  212. data/lib/karafka/pro/routing/features/patterns/contracts/consumer_group.rb +8 -0
  213. data/lib/karafka/pro/routing/features/patterns/contracts/pattern.rb +8 -0
  214. data/lib/karafka/pro/routing/features/patterns/contracts/topic.rb +8 -0
  215. data/lib/karafka/pro/routing/features/patterns/detector.rb +8 -0
  216. data/lib/karafka/pro/routing/features/patterns/pattern.rb +8 -0
  217. data/lib/karafka/pro/routing/features/patterns/patterns.rb +8 -0
  218. data/lib/karafka/pro/routing/features/patterns/topic.rb +8 -0
  219. data/lib/karafka/pro/routing/features/patterns/topics.rb +8 -0
  220. data/lib/karafka/pro/routing/features/patterns.rb +8 -0
  221. data/lib/karafka/pro/routing/features/pausing/config.rb +8 -0
  222. data/lib/karafka/pro/routing/features/pausing/contracts/topic.rb +8 -0
  223. data/lib/karafka/pro/routing/features/pausing/topic.rb +8 -0
  224. data/lib/karafka/pro/routing/features/pausing.rb +8 -0
  225. data/lib/karafka/pro/routing/features/periodic_job/config.rb +8 -0
  226. data/lib/karafka/pro/routing/features/periodic_job/contracts/topic.rb +8 -0
  227. data/lib/karafka/pro/routing/features/periodic_job/topic.rb +8 -0
  228. data/lib/karafka/pro/routing/features/periodic_job.rb +8 -0
  229. data/lib/karafka/pro/routing/features/recurring_tasks/builder.rb +8 -0
  230. data/lib/karafka/pro/routing/features/recurring_tasks/config.rb +8 -0
  231. data/lib/karafka/pro/routing/features/recurring_tasks/contracts/topic.rb +8 -0
  232. data/lib/karafka/pro/routing/features/recurring_tasks/proxy.rb +8 -0
  233. data/lib/karafka/pro/routing/features/recurring_tasks/topic.rb +8 -0
  234. data/lib/karafka/pro/routing/features/recurring_tasks.rb +8 -0
  235. data/lib/karafka/pro/routing/features/scheduled_messages/builder.rb +8 -0
  236. data/lib/karafka/pro/routing/features/scheduled_messages/config.rb +8 -0
  237. data/lib/karafka/pro/routing/features/scheduled_messages/contracts/topic.rb +8 -0
  238. data/lib/karafka/pro/routing/features/scheduled_messages/proxy.rb +8 -0
  239. data/lib/karafka/pro/routing/features/scheduled_messages/topic.rb +8 -0
  240. data/lib/karafka/pro/routing/features/scheduled_messages.rb +8 -0
  241. data/lib/karafka/pro/routing/features/swarm/config.rb +8 -0
  242. data/lib/karafka/pro/routing/features/swarm/contracts/routing.rb +8 -0
  243. data/lib/karafka/pro/routing/features/swarm/contracts/topic.rb +8 -0
  244. data/lib/karafka/pro/routing/features/swarm/topic.rb +8 -0
  245. data/lib/karafka/pro/routing/features/swarm.rb +8 -0
  246. data/lib/karafka/pro/routing/features/throttling/config.rb +8 -0
  247. data/lib/karafka/pro/routing/features/throttling/contracts/topic.rb +8 -0
  248. data/lib/karafka/pro/routing/features/throttling/topic.rb +8 -0
  249. data/lib/karafka/pro/routing/features/throttling.rb +8 -0
  250. data/lib/karafka/pro/routing/features/virtual_partitions/config.rb +8 -0
  251. data/lib/karafka/pro/routing/features/virtual_partitions/contracts/topic.rb +8 -0
  252. data/lib/karafka/pro/routing/features/virtual_partitions/topic.rb +8 -0
  253. data/lib/karafka/pro/routing/features/virtual_partitions.rb +8 -0
  254. data/lib/karafka/pro/scheduled_messages/consumer.rb +8 -0
  255. data/lib/karafka/pro/scheduled_messages/contracts/config.rb +8 -0
  256. data/lib/karafka/pro/scheduled_messages/contracts/message.rb +8 -0
  257. data/lib/karafka/pro/scheduled_messages/daily_buffer.rb +8 -0
  258. data/lib/karafka/pro/scheduled_messages/day.rb +8 -0
  259. data/lib/karafka/pro/scheduled_messages/deserializers/headers.rb +8 -0
  260. data/lib/karafka/pro/scheduled_messages/deserializers/payload.rb +8 -0
  261. data/lib/karafka/pro/scheduled_messages/dispatcher.rb +8 -0
  262. data/lib/karafka/pro/scheduled_messages/errors.rb +8 -0
  263. data/lib/karafka/pro/scheduled_messages/max_epoch.rb +8 -0
  264. data/lib/karafka/pro/scheduled_messages/proxy.rb +8 -0
  265. data/lib/karafka/pro/scheduled_messages/schema_validator.rb +8 -0
  266. data/lib/karafka/pro/scheduled_messages/serializer.rb +8 -0
  267. data/lib/karafka/pro/scheduled_messages/setup/config.rb +8 -0
  268. data/lib/karafka/pro/scheduled_messages/state.rb +8 -0
  269. data/lib/karafka/pro/scheduled_messages/tracker.rb +8 -0
  270. data/lib/karafka/pro/scheduled_messages.rb +8 -0
  271. data/lib/karafka/pro/setup/defaults_injector.rb +70 -0
  272. data/lib/karafka/pro/swarm/liveness_listener.rb +51 -24
  273. data/lib/karafka/processing/jobs_queue.rb +12 -4
  274. data/lib/karafka/processing/worker.rb +7 -2
  275. data/lib/karafka/processing/workers_pool.rb +158 -0
  276. data/lib/karafka/runner.rb +17 -17
  277. data/lib/karafka/server.rb +24 -6
  278. data/lib/karafka/setup/attributes_map.rb +2 -0
  279. data/lib/karafka/setup/config_proxy.rb +9 -1
  280. data/lib/karafka/setup/contracts/config.rb +17 -0
  281. data/lib/karafka/setup/defaults_injector.rb +10 -0
  282. data/lib/karafka/swarm/liveness_listener.rb +24 -8
  283. data/lib/karafka/swarm/manager.rb +7 -7
  284. data/lib/karafka/version.rb +1 -1
  285. metadata +8 -6
  286. data/lib/karafka/processing/workers_batch.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a0dd67b39af3fbad16ce4c96f061309d97e21ae95bcace2bab1e7879823a622
4
- data.tar.gz: 0061a806b411a0526826327be18946fb39fe90c324a82e45d329ef9a45e3168a
3
+ metadata.gz: 953c11ca73eda62bac76aaca94946b50b880a54e50756b0665da68155c9ad68d
4
+ data.tar.gz: a5d200ac66bc102d6dac680aaa03df1cc897113dc2af52f4684f3f7128608340
5
5
  SHA512:
6
- metadata.gz: 7cae09aabcea7cf6eb692bc5747dc51327601eebd680314a62c064c626f79db17a7a6c3f0e49a6a95859eeb4d6e30a51b7a6cb3b7acd1c69400734981e926db6
7
- data.tar.gz: 1c1c031bd16d1da91fa7fc3a2627e157db698b51883c91197c6cf5311d19abd8d9be75742db447d588e73c1a30dca196f991a4ec9ee49f31090fcb2863f45b47
6
+ metadata.gz: 96d8087bda95065a1b56f5a525b9dd53c9ec71d01d9dd51f56403f7a14fd5ee406f2c40a366e1bb607495ebea8ce76ddd379df08e8e76594cdfae5905ff9c3d0
7
+ data.tar.gz: 393f0264db679e7b71eeb2fe6c419090d6ff46a43354789fcef2e1e7e6baec3c839583982129669d02a6eae1d245396f48c0dcfebe475946ca2aa97dadce90ed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Karafka Framework Changelog
2
2
 
3
+ ## 2.5.10 (Unreleased)
4
+ - **[Feature]** Add `Processing::WorkersPool` with dynamic thread pool scaling via `#scale`, `nil` sentinel-based worker exit for downscaling, and `worker.scaling.up`/`worker.scaling.down` instrumentation events.
5
+ - [Enhancement] Add per-partition generation tracking to `AssignmentsTracker` to distinguish first-time assignments from reassignments.
6
+ - [Enhancement] Make liveness listeners fiber-safe.
7
+ - [Fix] Include orphaned node detection in Pro swarm liveness listener.
8
+ - [Fix] Report liveness on `connection.listener.before_fetch_loop` so nodes send an initial healthy report before the first consumption.
9
+ - [Fix] Fire liveness events during `wait_pinging` so nodes continue reporting health status during shutdown with active LRJ jobs.
10
+ - [Maintenance] Use namespaced topic naming format in all integration specs for consistent traceability.
11
+ - [Fix] Fix `DataCollector::SPEC_HASH` producing non-deterministic hashes for pristine and poro specs by passing the original spec path via `KARAFKA_SPEC_PATH` env var.
12
+ - [Maintenance] Add `bin/tests_topics_hashes` script for looking up spec files by their topic name hash prefix.
13
+ - [Change] Require `karafka-rdkafka` `>=` `0.26.1` to support upcoming features relying on low-level Rdkafka APIs.
14
+
15
+ ## 2.5.9 (2026-03-30)
16
+ - [Enhancement] Validate that `statistics.interval.ms` is not zero when dynamic multiplexing is enabled (Pro).
17
+ - [Fix] Fix swarm liveness reporting to also use `on_connection_listener_fetch_loop` so nodes stay alive when `statistics.interval.ms` is disabled.
18
+ - [Fix] Fix `ConfigProxy#producer` when called as a reader resetting the producer to nil instead of returning its value (#3076).
19
+ - [Fix] Fix `Replication#build_generate_command` using `--reassignment-json-file` with `--generate` instead of `--topics-to-move-json-file` and `--broker-list` ([#3087](https://github.com/karafka/karafka/issues/3087)).
20
+
3
21
  ## 2.5.8 (2026-03-23)
4
22
  - **[Feature]** Add `Karafka::Admin::Recovery` for coordinator-bypass offset reading and consumer group migration when the Kafka group coordinator is in a FAILED state (Pro).
5
23
 
data/LICENSE-COMM CHANGED
@@ -10,7 +10,7 @@ In order to use the Software under this Agreement, you must either: (a) receive
10
10
 
11
11
  1. License Grant
12
12
 
13
- 1.1 General Use. This Agreement grants you a non-exclusive, non-transferable, limited license to the use rights for the Software, without the right to grant sublicenses, subject to the terms and conditions in this Agreement. The Software is licensed, not sold.
13
+ 1.1 General Use. This Agreement grants you a non-exclusive, non-transferable, limited license to the use rights for the Software, without the right to grant sublicenses, subject to the terms and conditions in this Agreement. The Software is licensed, not sold. No patent rights are granted under this Agreement. This license grant covers only the copyright rights necessary to use the Software as expressly permitted herein.
14
14
 
15
15
  1.1.1 Entity Definition. Where you have purchased or otherwise acquired the Software as or for an entity, "you" and "your" refer exclusively to the single legal entity (such as a corporation, limited liability company, partnership, or other legally recognized organization) that is the named licensee. This license does not extend to any parent company, subsidiary, affiliate, related entity, or other member of a corporate group, regardless of ownership structure or control relationships. Each separate legal entity requires its own license.
16
16
 
@@ -30,7 +30,9 @@ In order to use the Software under this Agreement, you must either: (a) receive
30
30
 
31
31
  3.2 UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE AS PART OF A PRODUCT OR SERVICE THAT PROVIDES SIMILAR FUNCTIONALITY TO THE SOFTWARE ITSELF.
32
32
 
33
- 3.3 ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING PROHIBITION. WITHOUT LIMITING THE GENERALITY OF SECTION 3.1, THE SOFTWARE AND ITS SOURCE CODE MAY NOT BE USED IN ANY MANNER TO TRAIN, DEVELOP, IMPROVE, OR VALIDATE ANY ARTIFICIAL INTELLIGENCE OR MACHINE LEARNING SYSTEM. THIS PROHIBITION APPLIES REGARDLESS OF WHETHER THE SOFTWARE IS ACCESSED DIRECTLY, THROUGH AUTOMATED MEANS, OR VIA THIRD-PARTY DATASETS OR SERVICES. ANY SUCH USE CONSTITUTES A MATERIAL BREACH OF THIS AGREEMENT AND MAY RESULT IN IMMEDIATE TERMINATION OF YOUR LICENSE AND PURSUIT OF ALL AVAILABLE LEGAL REMEDIES. For clarity, this prohibition applies to the training and development of AI systems, and does not restrict licensed users from utilizing AI-powered development tools in the ordinary course of developing software that integrates with the Software.
33
+ 3.3 ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING PROHIBITION. WITHOUT LIMITING THE GENERALITY OF SECTION 3.1, THE SOFTWARE AND ITS SOURCE CODE MAY NOT BE USED IN ANY MANNER TO TRAIN, DEVELOP, IMPROVE, OR VALIDATE ANY ARTIFICIAL INTELLIGENCE OR MACHINE LEARNING SYSTEM. THIS PROHIBITION APPLIES REGARDLESS OF WHETHER THE SOFTWARE IS ACCESSED DIRECTLY, THROUGH AUTOMATED MEANS, OR VIA THIRD-PARTY DATASETS OR SERVICES. ANY SUCH USE CONSTITUTES A MATERIAL BREACH OF THIS AGREEMENT AND MAY RESULT IN IMMEDIATE TERMINATION OF YOUR LICENSE AND PURSUIT OF ALL AVAILABLE LEGAL REMEDIES. For clarity, this prohibition applies to the training and development of AI systems, and does not restrict licensed users from utilizing AI-powered development tools in the ordinary course of developing software that integrates with the Software. Additionally, runtime retrieval of the Software's source code by AI assistants, coding agents, and retrieval-augmented generation (RAG) systems is permitted solely for the purpose of providing contextual help to Karafka users, provided that such retrieval does not result in the storage, reproduction, or use of the source code for training, fine-tuning, or improving any AI or machine learning system.
34
+
35
+ 3.4 Source-Available Access. The Software's source code is made available for reading, referencing, and linking for personal or commercial use. This permits viewing the source code for informational purposes, referencing it in discussions or documentation, and linking to the official repository. Such access does not constitute a license to use, copy, reproduce, modify, or distribute the Software or any portion thereof. All restrictions in Sections 3.1, 3.2, and 3.3 remain fully applicable regardless of how the source code was accessed. Receipt, viewing, or possession of the Software's source code does not convey or imply any license or right beyond those expressly granted in this Agreement.
34
36
 
35
37
  The Open Source version of the Software ("LGPL Version") is licensed under the terms of the GNU Lesser General Public License version 3.0 ("LGPL") and not under this EULA.
36
38
 
data/certs/expired.txt CHANGED
@@ -1,2 +1,85 @@
1
1
  # Expired/revoked license checksums (SHA256 of license token)
2
2
  # One checksum per line, lines starting with # are comments
3
+
4
+ 01603767339fd25cf874e6fe29315fb27b6f6bbdf2e769c3b88e6efcf4096d37
5
+ 024e2c943693c4ea9eea852eb02d32acc9cb34df21aea90af5ab39dcf3b1d8cf
6
+ 0371303ba704d8f256b40932aa7840a1adb1cdc6fd032ac902794320d0d35ff1
7
+ 051dc2d8176df8d3bde1595e01af786a3f58ccab4cc48743d624e68125d80bd6
8
+ 06e3d91c9881ebf9686f3492e53400adc2c6a5fd4a409f6775cd36094b24f181
9
+ 0ae8daf74b8ccd6c4828ed707edf0d05df3e7d328e91ddc973e160ae8b120787
10
+ 0b4420e202d9c6075bb108ac4bd5917e35e89aa7d1741afaab93ca07839d06fc
11
+ 11936f8e0637565a309157d1fd4e84a3c44e5a3f9f226435e7d38bc43e452db6
12
+ 122ecfd0493596239995b9e7425046737b4893e28e33f31815eb4727c3f607d9
13
+ 17c14c38e10d0d2bd4a9c847a2c23fd0726459337af1d9815b6e34d1fd9af8be
14
+ 227f48f0b22974c43f120de28d5ca33a77e58d33064f9a73748501ba700f1474
15
+ 24d59b10d982e5642dfda3ec54cd56dda9022927c89584bbe12d31f3df28e17d
16
+ 2634761cc75479548003f941346f0a51a6c535415696f386b40ae28f88f63efa
17
+ 284967207a93e9c989d05ad6e5bb0dbe3e0a8a871c3fba48324558f127166bda
18
+ 2e2b4ccd902e43feb418cc8b3aed5874ec194ae8495ded864aff917538d91f7a
19
+ 39aeae710122bf14729a05f24f5bd702d2a1127e5c7fb9bd90de0e20890575dc
20
+ 3ada575caaf0b8bdeca0686a93074de9ed830751e6f46251849475f70e84e408
21
+ 4367e57ca36a4b447f23745d76611514df61b56611225be4c8f9a90560bbace9
22
+ 47380207ca3041b14c7d4c81a69f820852069ecab4d80a068d39133f61a6e641
23
+ 4d49b497ece81604358afc8e9adc7d1163995c4c08446bcd5c0bbfe3d7ebc1e7
24
+ 4d97c95c46e51105705964aecbfa5219120295e7d0a172f5c098d12c3a5cbf7e
25
+ 60171be4b327d48b2445b00f1fca3d2a3554d06c69f63f3e97742b29030a0a69
26
+ 630907de3c6bf258bfc2c51d768d51ca446ebd49fb29b29a0b24d363d46d1a6e
27
+ 68db4a9700f6cc3494f8eac1e0df2471f11ef7312e7b58dae839b193e226fae5
28
+ 6a06fb85cee01a27a5e819e464b0b5fd84051d234540d11774bc17e90c91abd4
29
+ 6d79bcac25c0026dad0f1871ccae79fc07d696df2e0f080ce1d1038454545a05
30
+ 6e2ed71a0925d59815c49ea1e72dfd0ba28bdbb57f93d81fa34a31c50db53830
31
+ 711a3cced55062707b64f6d652e107d0f1318fd9f3762c732fad23d04884cdd2
32
+ 71c2d2ab89a11010c41c9938fbc2565297364b4e8378e78ddf58b22ea2c43ca2
33
+ 72b19e6e274b1f36799eea65b07f4849db44c82315647266608ebdb6fde0cad6
34
+ 731c0d75d9b47cca49d9d95fc8d291fda452383f920e70849373959892443329
35
+ 77b6974b96701d82a0670c79830543e345bf0a00d9e5b5a1bbf8443439d75987
36
+ 77e461a9a4534870cfb7cca350d56ed0a504643bb39eeb750b338179d05069a9
37
+ 7c06718c4314e28561f337b3ecc66fb012c2510f1ed5fcb82dbab5ba009a8f7d
38
+ 7ca5a6183ed9c97e4da2c7030f809bfb32da49319d106377bd0e6d7d52734141
39
+ 7ce4cade640a4f34e2909360c4c0ceb8a647b7bfead7a57880d8ce2bf6eea26c
40
+ 7d3a2cb0ab08f2f25324124973370da30210dab04abaeeed97192576238a03e0
41
+ 7dc790fd8bf18e663c2e4276f4362b0c14795945b508807ef03a92ece266cff8
42
+ 81e69732cc6e9c5266fffea08fd1c69fd12c1d841b979723a77533c5efef244e
43
+ 839f4a449e0d68acccc0f6a2d0209d2d137375d740ae6d0244dde17e63131fbb
44
+ 85d26e4fedf364e20ea33c1b0102d34cea19156243fe781ddf597f6677cf2de3
45
+ 8609d26341a5c4e908af8b63bcc6895d99d8cc13f0403dc7b36a2920bb8e048a
46
+ 8d3e09a94bd00710a49b186be832f74cc3340ec3d87e780e10159e5e8d048b81
47
+ 8e933669352c272935c310d7ce798b3ea2687611378b978e412491e7fddfce4d
48
+ 8f3190524285a5c0a0d1e24bdc2a5c417416c2cb92b9da26f0e492aaa4600bd7
49
+ 9221a49b42e05d39e1939cf9353805abea2042457c2247859e3274976ac2fbc6
50
+ 96c8dde1a7f938899f3f5bd764eff295f090e1c40635e7efd25d69ef55881db2
51
+ 9b0b791259e86740d4a2cab736802614938b7043479ac8770c570b1b37f38fb7
52
+ a0db6c5e7c8714a2d33adff3b69d2d688d5a34e6d5ba871d1cbdfcba3edf1e89
53
+ a7ce882d45a00ad82e653b60d14f1a1ebefdc9033d6cc60ed0a2ed507949a9a2
54
+ ac2941c112f397543fde83cc1b0dcf70ec34d77e149d3e90ad07a0f1bc809933
55
+ adea773fadaaaeadf0f20643e84ae6c40bcb55fb73ecee5894a41836453e4abb
56
+ b1411e92ad939b59c898e78520c8ec82547950493a45004b747f12820aa7d390
57
+ b3984622fbc6ba91a2180283a6ada7e1bbe01fb705dbaae37c831e9c893b8e00
58
+ b5ed1ff168e86300735e59dc2786be6d535fc9e0f3c6c8a76bc4354cbbed4ae0
59
+ b9e38e9c1b34db847a4b82ae35382b06e61a5872aa8c24f988d7d5246ded4648
60
+ bdc4f155153a59c25c7c52932f77973487d6336e99eb0beeb90edf4a4120a94a
61
+ bf6c5c58b02fa5e7c7dc845213ad943c5b6613f12ac6012be00b1484bb85aa04
62
+ c011c3d168a159c135ef35bf55121edaf1a4cc94f663a1f461595776b0313160
63
+ c311cb6cfb38a8b2e83b3080c1f87444a52f3f645be8337559a123aaacf1344a
64
+ c87222a94f98c3a2191dda9254bd6ed031fd8ca190f75b40c67a0fcd4b56f795
65
+ ca53af70cd7e67abbb9dbf0a8da6788a9b2192aa3a5a1dd8720aaa68a2511722
66
+ d02da0cbd2c1d83432a2cee7984dd311249692373554002d1d543dd5007f6a58
67
+ d13295e597120b88bf4c4f36de63d0aa3e5a68e3578c09a2e026bd1f6aaaf04f
68
+ d862dd776d5b42a73a63574dc00187c587403101cd211ed348fc422f6460844e
69
+ d9f25b56eae6a62b9383c068c2a7c22ef6b051f1cf4137164ba3dd1baf0bac61
70
+ db1f2c50f3dc6956c498b06f67f82412a76f0b138265a55713076b2a4a35725f
71
+ ded7405c91e9bb1994c58c728f83b705fdc5e816ce0cb3fdf16887127fff27f0
72
+ dfe08da10ae5e74e9bbf648261860f3b94201a11ab4269cd4db7c73017452dde
73
+ dff7372b5ee3136af892561507602423bbae42d12d3a65277ae2af1add666723
74
+ e1a040c0c9a6c5e4603d9aebbc4201075238b47446348ab635b53704b3095a63
75
+ e3b94496b65bb626e723637926e729a33be673fe0355d964306bde563ff6fbf7
76
+ e577d74987f1d31c10fc4ec67dd74084486514f844668d7d01bd4cad2d8f09c4
77
+ e7a91a5ce0e68b888026bbddb57c92c7d5ad61e9416c8188721eee0a8ba85bc1
78
+ eda2ab2c99f769d646dd6fff564af9ec6f32e4462390e3b3246bf953cd7a9c70
79
+ f031aa98b2375c6573f6f775f6000dc81e07b1034694742a900a9115eb124900
80
+ f1ade1306fd64c2e32b15e505d87c0a9ec7a8392f5bea014fc4e70acd17f9935
81
+ f397ccd272b6ee7b33595aa93a6e40b725af265b681efca05bb26f9a7766d6c2
82
+ f54723b14f7cfc4e3c88b946cab881b907dd5ac8372b4600213241ab82778979
83
+ f9cc7b7d9c7d81ba477a70749d166edbc2b44f1714096fce10118bb18fd9696c
84
+ fb417a807d7595a4aff44cc79712e9bc887181e64eb9a98fe9f200b585856ae7
85
+ fd5009f463fe0c38cfe66677ff9b8e5031cbc4ce354883c99c392109ae8ae3b8
@@ -25,6 +25,9 @@ en:
25
25
  Decrease max_wait_time or increase node_report_timeout
26
26
  kafka_format: needs to be a filled hash
27
27
  key_must_be_a_symbol: All keys under the kafka settings scope need to be symbols
28
+ managed_key_not_supported: >
29
+ this kafka setting is managed internally by Karafka and should not be set directly.
30
+ Setting it manually may cause misbehaviours and other unexpected issues
28
31
  pause.timeout_max_timeout_vs_pause_max_timeout: pause.timeout must be less or equal to pause.max_timeout
29
32
  shutdown_timeout_vs_max_wait_time: shutdown_timeout must be more than max_wait_time
30
33
  worker_thread_priority_format: must be between -3 and 3
@@ -2,6 +2,7 @@ en:
2
2
  validations:
3
3
  routing:
4
4
  swarm_nodes_not_used: 'At least one of the nodes has no assignments'
5
+ multiplexing_statistics_required_for_dynamic_multiplexing: 'Dynamic multiplexing requires statistics to be enabled (statistics.interval.ms must be greater than 0)'
5
6
 
6
7
  topic:
7
8
  virtual_partitions.partitioner_respond_to_call: needs to be defined and needs to respond to `#call`
data/karafka.gemspec CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  without having to focus on things that are not your business domain.
22
22
  DESC
23
23
 
24
- spec.add_dependency "karafka-core", ">= 2.5.6", "< 2.6.0"
25
- spec.add_dependency "karafka-rdkafka", ">= 0.24.0"
24
+ spec.add_dependency "karafka-core", ">= 2.5.13", "< 2.6.0"
25
+ spec.add_dependency "karafka-rdkafka", ">= 0.26.1"
26
26
  spec.add_dependency "waterdrop", ">= 2.8.14", "< 3.0.0"
27
27
  spec.add_dependency "zeitwerk", "~> 2.3"
28
28
 
@@ -55,6 +55,7 @@ module Karafka
55
55
  :target_replication_factor,
56
56
  :partitions_assignment,
57
57
  :reassignment_json,
58
+ :topics_to_move_json,
58
59
  :execution_commands,
59
60
  :steps
60
61
  )
@@ -108,6 +109,7 @@ module Karafka
108
109
  @cluster_info = cluster_info
109
110
 
110
111
  generate_reassignment_json
112
+ generate_topics_to_move_json
111
113
  generate_execution_commands
112
114
  generate_steps
113
115
 
@@ -256,6 +258,15 @@ module Karafka
256
258
  file_path
257
259
  end
258
260
 
261
+ # Export the topics-to-move JSON to a file for use with kafka-reassign-partitions.sh
262
+ # --generate. This optional step lets you ask Kafka to propose its own reassignment plan
263
+ # so you can compare it against the plan Karafka generated before executing.
264
+ # @param file_path [String] path where to save the JSON file
265
+ def export_topics_to_move_file(file_path)
266
+ File.write(file_path, @topics_to_move_json)
267
+ file_path
268
+ end
269
+
259
270
  # @return [String] human-readable summary of the plan
260
271
  def summary
261
272
  broker_count = @cluster_info[:brokers].size
@@ -428,6 +439,19 @@ module Karafka
428
439
  @reassignment_json = JSON.pretty_generate(reassignment_data)
429
440
  end
430
441
 
442
+ # Generates the topics-to-move JSON required by kafka-reassign-partitions.sh --generate.
443
+ # This file is only needed when you want Kafka to propose its own reassignment plan for
444
+ # comparison against the plan Karafka already computed. It is not required for execution.
445
+ # @return [void]
446
+ def generate_topics_to_move_json
447
+ topics_data = {
448
+ version: 1,
449
+ topics: [{ topic: @topic }]
450
+ }
451
+
452
+ @topics_to_move_json = JSON.pretty_generate(topics_data)
453
+ end
454
+
431
455
  # Generates command templates for executing the reassignment plan
432
456
  # Builds generate, execute, and verify command templates with placeholders
433
457
  # @return [void]
@@ -439,11 +463,16 @@ module Karafka
439
463
  }
440
464
  end
441
465
 
442
- # Builds the kafka-reassign-partitions.sh command for generating reassignment plan
443
- # @return [String] command template with placeholder for broker addresses
466
+ # Builds the kafka-reassign-partitions.sh --generate command that asks Kafka to propose
467
+ # its own reassignment plan. This is optional you can compare Kafka's suggestion against
468
+ # the plan Karafka already computed, or skip this step and go straight to --execute.
469
+ # @return [String] command template with placeholders for broker addresses and IDs
444
470
  def build_generate_command
471
+ broker_ids = @cluster_info[:brokers].map { |b| b[:node_id] }.sort.join(",")
472
+
445
473
  "kafka-reassign-partitions.sh --bootstrap-server <KAFKA_BROKERS> " \
446
- "--reassignment-json-file reassignment.json --generate"
474
+ "--topics-to-move-json-file topics-to-move.json " \
475
+ "--broker-list #{broker_ids} --generate"
447
476
  end
448
477
 
449
478
  # Builds the kafka-reassign-partitions.sh command for executing reassignment
@@ -466,7 +495,10 @@ module Karafka
466
495
  def generate_steps
467
496
  @steps = [
468
497
  "1. Export the reassignment JSON using: plan.export_to_file('reassignment.json')",
469
- "2. Validate the plan (optional): #{@execution_commands[:generate]}",
498
+ "2. (Optional) Compare against Kafka's own proposal:",
499
+ " a. Export topics-to-move JSON: plan.export_topics_to_move_file('topics-to-move.json')",
500
+ " b. Ask Kafka to generate its plan: #{@execution_commands[:generate]}",
501
+ " c. Compare Kafka's output with the Karafka-generated reassignment.json above",
470
502
  "3. Execute the reassignment: #{@execution_commands[:execute]}",
471
503
  "4. Monitor progress: #{@execution_commands[:verify]}",
472
504
  "5. Verify completion by checking topic metadata",
@@ -401,10 +401,14 @@ module Karafka
401
401
  # - OAUTHBEARER token refresh callbacks
402
402
  #
403
403
  # @param timeout [Integer] number of milliseconds to wait on events or 0 not to wait.
404
+ # @param safe [Boolean] when true, rescues Rdkafka::RdkafkaError so callers in
405
+ # shutdown/quiet paths do not trigger a full listener reset. When shutting down, errors
406
+ # at this layer are not relevant enough. We want to log them but we should not propagate
407
+ # them any further.
404
408
  #
405
409
  # @note It is non-blocking when timeout 0 and will not wait if queue empty. It costs up to
406
410
  # 2ms when no callbacks are triggered.
407
- def events_poll(timeout = 0)
411
+ def events_poll(timeout = 0, safe: false)
408
412
  kafka.events_poll(timeout)
409
413
 
410
414
  # Emit event for monitoring - happens once per tick_interval (default 5s)
@@ -414,6 +418,8 @@ module Karafka
414
418
  caller: self,
415
419
  subscription_group: @subscription_group
416
420
  )
421
+ rescue Rdkafka::RdkafkaError
422
+ safe ? nil : raise
417
423
  end
418
424
 
419
425
  # Returns pointer to the consumer group metadata. It is used only in the context of
@@ -50,7 +50,7 @@ module Karafka
50
50
  @executors = Processing::ExecutorsBuffer.new(@client, subscription_group)
51
51
  @partitioner = partitioner_class.new(subscription_group)
52
52
  @scheduler = scheduler
53
- @events_poller = Helpers::IntervalRunner.new { @client.events_poll }
53
+ @events_poller = Helpers::IntervalRunner.new { |**opts| @client.events_poll(**opts) }
54
54
  # We keep one buffer for messages to preserve memory and not allocate extra objects
55
55
  # We can do this that way because we always first schedule jobs using messages before we
56
56
  # fetch another batch.
@@ -499,6 +499,7 @@ module Karafka
499
499
  until wait_until.call
500
500
  @client.ping
501
501
  @scheduler.on_manage
502
+ @events_poller.call(safe: true)
502
503
 
503
504
  after_ping.call
504
505
  sleep(0.2)
@@ -25,14 +25,14 @@ module Karafka
25
25
  end
26
26
 
27
27
  # Runs the requested code if it was not executed previously recently
28
- def call
28
+ def call(...)
29
29
  now = monotonic_now
30
30
 
31
31
  return if now - @last_called_at < @interval
32
32
 
33
33
  @last_called_at = now
34
34
 
35
- @block.call
35
+ @block.call(...)
36
36
  end
37
37
 
38
38
  # Runs the requested code bypassing any time frequencies
@@ -14,10 +14,33 @@ module Karafka
14
14
  class AssignmentsTracker
15
15
  include Singleton
16
16
 
17
+ class << self
18
+ # @return [Hash{Karafka::Routing::Topic => Array<Integer>}]
19
+ # @see #current
20
+ def current
21
+ instance.current
22
+ end
23
+
24
+ # @return [Hash{Karafka::Routing::Topic => Hash{Integer => Integer}}]
25
+ # @see #generations
26
+ def generations
27
+ instance.generations
28
+ end
29
+
30
+ # @param topic [Karafka::Routing::Topic]
31
+ # @param partition [Integer]
32
+ # @return [Integer]
33
+ # @see #generation
34
+ def generation(topic, partition)
35
+ instance.generation(topic, partition)
36
+ end
37
+ end
38
+
17
39
  # Initializes the assignments tracker with empty assignments
18
40
  def initialize
19
41
  @mutex = Mutex.new
20
42
  @assignments = Hash.new { |hash, key| hash[key] = [] }
43
+ @generations = Hash.new { |h, k| h[k] = {} }
21
44
  end
22
45
 
23
46
  # Returns all the active/current assignments of this given process
@@ -44,10 +67,41 @@ module Karafka
44
67
  assignments.freeze
45
68
  end
46
69
 
47
- # Clears all the assignments
70
+ # Returns the generation counts for all partitions that have ever been assigned
71
+ #
72
+ # @return [Hash{Karafka::Routing::Topic => Hash{Integer => Integer}}] topic to partition
73
+ # generation mapping. Generation starts at 1 on first assignment and increments on each
74
+ # reassignment. Revoked partitions remain in the hash with their last generation value.
75
+ #
76
+ # @note Returns a frozen deep copy to prevent external mutation
77
+ def generations
78
+ result = {}
79
+
80
+ @mutex.synchronize do
81
+ @generations.each do |topic, partitions|
82
+ result[topic] = partitions.dup.freeze
83
+ end
84
+ end
85
+
86
+ result.freeze
87
+ end
88
+
89
+ # Returns the generation count for a specific topic-partition
90
+ #
91
+ # @param topic [Karafka::Routing::Topic]
92
+ # @param partition [Integer]
93
+ # @return [Integer] generation count (0 if never assigned, 1+ otherwise)
94
+ def generation(topic, partition)
95
+ @mutex.synchronize do
96
+ @generations.dig(topic, partition) || 0
97
+ end
98
+ end
99
+
100
+ # Clears all the assignments and generations
48
101
  def clear
49
102
  @mutex.synchronize do
50
103
  @assignments.clear
104
+ @generations.clear
51
105
  end
52
106
  end
53
107
 
@@ -125,7 +179,16 @@ module Karafka
125
179
  event[:tpl].to_h.each do |topic, partitions|
126
180
  topic = sg.topics.find(topic)
127
181
 
128
- @assignments[topic] += partitions.map(&:partition)
182
+ partition_ids = []
183
+
184
+ partitions.each do |partition|
185
+ partition_id = partition.partition
186
+ partition_ids << partition_id
187
+ @generations[topic][partition_id] ||= 0
188
+ @generations[topic][partition_id] += 1
189
+ end
190
+
191
+ @assignments[topic] += partition_ids
129
192
  @assignments[topic].sort!
130
193
  end
131
194
  end
@@ -93,6 +93,25 @@ module Karafka
93
93
  MSG
94
94
  end
95
95
 
96
+ # Logs info about the workers pool scaling up
97
+ #
98
+ # @param event [Karafka::Core::Monitoring::Event] event details including payload
99
+ def on_worker_scaling_up(event)
100
+ from = event[:from]
101
+ to = event[:to]
102
+ info "Workers pool scaled up from #{from} to #{to} workers"
103
+ end
104
+
105
+ # Logs info about the workers pool scaling down.
106
+ # The actual size change happens asynchronously as workers pick up nil sentinels and exit.
107
+ #
108
+ # @param event [Karafka::Core::Monitoring::Event] event details including payload
109
+ def on_worker_scaling_down(event)
110
+ from = event[:from]
111
+ to = event[:to]
112
+ info "Workers pool scaling down from #{from} to #{to} workers"
113
+ end
114
+
96
115
  # Prints info about a consumer pause occurrence. Irrelevant if user or system initiated.
97
116
  #
98
117
  # @param event [Karafka::Core::Monitoring::Event] event details including payload
@@ -108,6 +108,8 @@ module Karafka
108
108
  worker.process
109
109
  worker.processed
110
110
  worker.completed
111
+ worker.scaling.up
112
+ worker.scaling.down
111
113
 
112
114
  error.occurred
113
115
  ].freeze
@@ -328,10 +328,8 @@ module Karafka
328
328
 
329
329
  # Sends minute based probing metrics
330
330
  def minute_probe
331
- concurrency = Karafka::App.config.concurrency
332
-
333
331
  count("processes_count", 1, {})
334
- count("threads_count", concurrency, {})
332
+ count("threads_count", Karafka::Server.workers.size, {})
335
333
  end
336
334
  end
337
335
  end
@@ -164,7 +164,7 @@ module Karafka
164
164
  jq_stats = event[:jobs_queue].statistics
165
165
 
166
166
  tags = default_tags
167
- gauge("worker.total_threads", Karafka::App.config.concurrency, tags: tags)
167
+ gauge("worker.total_threads", Karafka::Server.workers.size, tags: tags)
168
168
  histogram("worker.processing", jq_stats[:busy], tags: tags)
169
169
  histogram("worker.enqueued_jobs", jq_stats[:enqueued], tags: tags)
170
170
  end
@@ -158,36 +158,39 @@ module Karafka
158
158
  @mutex.synchronize(&)
159
159
  end
160
160
 
161
- # @return [Integer] object id of the current thread
162
- def thread_id
163
- Thread.current.object_id
161
+ # @return [Integer] object id of the current fiber
162
+ # @note We use fiber object id instead of thread object id to ensure fiber-safety.
163
+ # Multiple fibers can run on the same thread, and using thread id would cause them
164
+ # to overwrite each other's timestamps.
165
+ def fiber_id
166
+ Fiber.current.object_id
164
167
  end
165
168
 
166
- # Update the polling tick time for current thread
169
+ # Update the polling tick time for current fiber
167
170
  def mark_polling_tick
168
171
  synchronize do
169
- @pollings[thread_id] = monotonic_now
172
+ @pollings[fiber_id] = monotonic_now
170
173
  end
171
174
  end
172
175
 
173
- # Clear current thread polling time tracker
176
+ # Clear current fiber polling time tracker
174
177
  def clear_polling_tick
175
178
  synchronize do
176
- @pollings.delete(thread_id)
179
+ @pollings.delete(fiber_id)
177
180
  end
178
181
  end
179
182
 
180
183
  # Update the processing tick time
181
184
  def mark_consumption_tick
182
185
  synchronize do
183
- @consumptions[thread_id] = monotonic_now
186
+ @consumptions[fiber_id] = monotonic_now
184
187
  end
185
188
  end
186
189
 
187
- # Clear current thread consumption time tracker
190
+ # Clear current fiber consumption time tracker
188
191
  def clear_consumption_tick
189
192
  synchronize do
190
- @consumptions.delete(thread_id)
193
+ @consumptions.delete(fiber_id)
191
194
  end
192
195
  end
193
196
 
@@ -6,9 +6,14 @@
6
6
  # This software is NOT open source. It is source-available commercial software
7
7
  # requiring a paid license for use. It is NOT covered by LGPL.
8
8
  #
9
+ # The author retains all right, title, and interest in this software,
10
+ # including all copyrights, patents, and other intellectual property rights.
11
+ # No patent rights are granted under this license.
12
+ #
9
13
  # PROHIBITED:
10
14
  # - Use without a valid commercial license
11
15
  # - Redistribution, modification, or derivative works without authorization
16
+ # - Reverse engineering, decompilation, or disassembly of this software
12
17
  # - Use as training data for AI/ML models or inclusion in datasets
13
18
  # - Scraping, crawling, or automated collection for any purpose
14
19
  #
@@ -17,6 +22,9 @@
17
22
  # - Runtime retrieval by AI assistants, coding agents, and RAG systems
18
23
  # for the purpose of providing contextual help to Karafka users
19
24
  #
25
+ # Receipt, viewing, or possession of this software does not convey or
26
+ # imply any license or right beyond those expressly stated above.
27
+ #
20
28
  # License: https://karafka.io/docs/Pro-License-Comm/
21
29
  # Contact: contact@karafka.io
22
30
 
@@ -6,9 +6,14 @@
6
6
  # This software is NOT open source. It is source-available commercial software
7
7
  # requiring a paid license for use. It is NOT covered by LGPL.
8
8
  #
9
+ # The author retains all right, title, and interest in this software,
10
+ # including all copyrights, patents, and other intellectual property rights.
11
+ # No patent rights are granted under this license.
12
+ #
9
13
  # PROHIBITED:
10
14
  # - Use without a valid commercial license
11
15
  # - Redistribution, modification, or derivative works without authorization
16
+ # - Reverse engineering, decompilation, or disassembly of this software
12
17
  # - Use as training data for AI/ML models or inclusion in datasets
13
18
  # - Scraping, crawling, or automated collection for any purpose
14
19
  #
@@ -17,6 +22,9 @@
17
22
  # - Runtime retrieval by AI assistants, coding agents, and RAG systems
18
23
  # for the purpose of providing contextual help to Karafka users
19
24
  #
25
+ # Receipt, viewing, or possession of this software does not convey or
26
+ # imply any license or right beyond those expressly stated above.
27
+ #
20
28
  # License: https://karafka.io/docs/Pro-License-Comm/
21
29
  # Contact: contact@karafka.io
22
30
 
@@ -6,9 +6,14 @@
6
6
  # This software is NOT open source. It is source-available commercial software
7
7
  # requiring a paid license for use. It is NOT covered by LGPL.
8
8
  #
9
+ # The author retains all right, title, and interest in this software,
10
+ # including all copyrights, patents, and other intellectual property rights.
11
+ # No patent rights are granted under this license.
12
+ #
9
13
  # PROHIBITED:
10
14
  # - Use without a valid commercial license
11
15
  # - Redistribution, modification, or derivative works without authorization
16
+ # - Reverse engineering, decompilation, or disassembly of this software
12
17
  # - Use as training data for AI/ML models or inclusion in datasets
13
18
  # - Scraping, crawling, or automated collection for any purpose
14
19
  #
@@ -17,6 +22,9 @@
17
22
  # - Runtime retrieval by AI assistants, coding agents, and RAG systems
18
23
  # for the purpose of providing contextual help to Karafka users
19
24
  #
25
+ # Receipt, viewing, or possession of this software does not convey or
26
+ # imply any license or right beyond those expressly stated above.
27
+ #
20
28
  # License: https://karafka.io/docs/Pro-License-Comm/
21
29
  # Contact: contact@karafka.io
22
30
 
@@ -6,9 +6,14 @@
6
6
  # This software is NOT open source. It is source-available commercial software
7
7
  # requiring a paid license for use. It is NOT covered by LGPL.
8
8
  #
9
+ # The author retains all right, title, and interest in this software,
10
+ # including all copyrights, patents, and other intellectual property rights.
11
+ # No patent rights are granted under this license.
12
+ #
9
13
  # PROHIBITED:
10
14
  # - Use without a valid commercial license
11
15
  # - Redistribution, modification, or derivative works without authorization
16
+ # - Reverse engineering, decompilation, or disassembly of this software
12
17
  # - Use as training data for AI/ML models or inclusion in datasets
13
18
  # - Scraping, crawling, or automated collection for any purpose
14
19
  #
@@ -17,6 +22,9 @@
17
22
  # - Runtime retrieval by AI assistants, coding agents, and RAG systems
18
23
  # for the purpose of providing contextual help to Karafka users
19
24
  #
25
+ # Receipt, viewing, or possession of this software does not convey or
26
+ # imply any license or right beyond those expressly stated above.
27
+ #
20
28
  # License: https://karafka.io/docs/Pro-License-Comm/
21
29
  # Contact: contact@karafka.io
22
30