karafka 2.4.0 → 2.4.18
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +26 -34
- data/.github/workflows/ci.yml +18 -6
- data/.ruby-version +1 -1
- data/CHANGELOG.md +146 -1
- data/Gemfile +10 -5
- data/Gemfile.lock +60 -39
- data/LICENSE +8 -3
- data/bin/integrations +13 -1
- data/certs/cert.pem +26 -0
- data/config/locales/errors.yml +18 -2
- data/config/locales/pro_errors.yml +44 -0
- data/docker-compose.yml +1 -3
- data/karafka.gemspec +6 -4
- data/lib/active_job/queue_adapters/karafka_adapter.rb +18 -7
- data/lib/karafka/active_job/dispatcher.rb +13 -0
- data/lib/karafka/active_job/job_extensions.rb +3 -0
- data/lib/karafka/admin.rb +86 -0
- data/lib/karafka/app.rb +17 -0
- data/lib/karafka/base_consumer.rb +130 -19
- data/lib/karafka/cli/base.rb +24 -8
- data/lib/karafka/cli/install.rb +2 -1
- data/lib/karafka/cli/server.rb +1 -0
- data/lib/karafka/cli/swarm.rb +1 -0
- data/lib/karafka/cli/topics/align.rb +12 -2
- data/lib/karafka/cli/topics/plan.rb +54 -6
- data/lib/karafka/cli/topics.rb +45 -18
- data/lib/karafka/connection/client.rb +102 -35
- data/lib/karafka/connection/listener.rb +48 -11
- data/lib/karafka/connection/messages_buffer.rb +19 -6
- data/lib/karafka/connection/proxy.rb +3 -0
- data/lib/karafka/connection/raw_messages_buffer.rb +43 -9
- data/lib/karafka/connection/rebalance_manager.rb +24 -13
- data/lib/karafka/contracts/config.rb +4 -0
- data/lib/karafka/contracts/consumer_group.rb +17 -0
- data/lib/karafka/contracts/routing.rb +59 -0
- data/lib/karafka/contracts/topic.rb +14 -0
- data/lib/karafka/embedded.rb +46 -3
- data/lib/karafka/errors.rb +3 -2
- data/lib/karafka/helpers/async.rb +11 -2
- data/lib/karafka/helpers/config_importer.rb +13 -0
- data/lib/karafka/instrumentation/assignments_tracker.rb +7 -2
- data/lib/karafka/instrumentation/logger_listener.rb +45 -4
- data/lib/karafka/instrumentation/notifications.rb +12 -0
- data/lib/karafka/instrumentation/vendors/appsignal/client.rb +32 -11
- data/lib/karafka/instrumentation/vendors/appsignal/errors_listener.rb +1 -1
- data/lib/karafka/instrumentation/vendors/appsignal/metrics_listener.rb +3 -1
- data/lib/karafka/instrumentation/vendors/datadog/logger_listener.rb +17 -19
- data/lib/karafka/instrumentation/vendors/datadog/metrics_listener.rb +27 -18
- data/lib/karafka/instrumentation/vendors/kubernetes/base_listener.rb +2 -2
- data/lib/karafka/instrumentation/vendors/kubernetes/liveness_listener.rb +41 -13
- data/lib/karafka/messages/message.rb +9 -9
- data/lib/karafka/pro/active_job/consumer.rb +2 -10
- data/lib/karafka/pro/active_job/dispatcher.rb +67 -19
- data/lib/karafka/pro/active_job/job_options_contract.rb +12 -10
- data/lib/karafka/pro/base_consumer.rb +2 -10
- data/lib/karafka/pro/cleaner/errors.rb +2 -10
- data/lib/karafka/pro/cleaner/messages/message.rb +14 -12
- data/lib/karafka/pro/cleaner/messages/messages.rb +2 -10
- data/lib/karafka/pro/cleaner/messages/metadata.rb +41 -0
- data/lib/karafka/pro/cleaner.rb +3 -10
- data/lib/karafka/pro/connection/manager.rb +6 -10
- data/lib/karafka/pro/connection/multiplexing/listener.rb +2 -10
- data/lib/karafka/pro/contracts/base.rb +2 -10
- data/lib/karafka/pro/contracts/server_cli_options.rb +2 -10
- data/lib/karafka/pro/encryption/cipher.rb +2 -10
- data/lib/karafka/pro/encryption/contracts/config.rb +2 -10
- data/lib/karafka/pro/encryption/errors.rb +2 -10
- data/lib/karafka/pro/encryption/messages/middleware.rb +2 -10
- data/lib/karafka/pro/encryption/messages/parser.rb +2 -10
- data/lib/karafka/pro/encryption/setup/config.rb +2 -10
- data/lib/karafka/pro/encryption.rb +2 -10
- data/lib/karafka/pro/instrumentation/performance_tracker.rb +2 -10
- data/lib/karafka/pro/iterator/expander.rb +2 -10
- data/lib/karafka/pro/iterator/tpl_builder.rb +2 -10
- data/lib/karafka/pro/iterator.rb +2 -10
- data/lib/karafka/pro/loader.rb +5 -11
- data/lib/karafka/pro/processing/adaptive_iterator/consumer.rb +54 -0
- data/lib/karafka/pro/processing/adaptive_iterator/tracker.rb +67 -0
- data/lib/karafka/pro/processing/collapser.rb +2 -10
- data/lib/karafka/pro/processing/coordinator.rb +2 -10
- data/lib/karafka/pro/processing/coordinators/errors_tracker.rb +2 -10
- data/lib/karafka/pro/processing/coordinators/filters_applier.rb +19 -10
- data/lib/karafka/pro/processing/coordinators/virtual_offset_manager.rb +2 -10
- data/lib/karafka/pro/processing/executor.rb +2 -10
- data/lib/karafka/pro/processing/expansions_selector.rb +3 -10
- data/lib/karafka/pro/processing/filters/base.rb +14 -10
- data/lib/karafka/pro/processing/filters/delayer.rb +4 -12
- data/lib/karafka/pro/processing/filters/expirer.rb +2 -10
- data/lib/karafka/pro/processing/filters/inline_insights_delayer.rb +2 -10
- data/lib/karafka/pro/processing/filters/throttler.rb +2 -10
- data/lib/karafka/pro/processing/filters/virtual_limiter.rb +2 -10
- data/lib/karafka/pro/processing/jobs/consume_non_blocking.rb +4 -10
- data/lib/karafka/pro/processing/jobs/eofed_non_blocking.rb +26 -0
- data/lib/karafka/pro/processing/jobs/periodic.rb +4 -10
- data/lib/karafka/pro/processing/jobs/periodic_non_blocking.rb +4 -10
- data/lib/karafka/pro/processing/jobs/revoked_non_blocking.rb +4 -10
- data/lib/karafka/pro/processing/jobs_builder.rb +14 -10
- data/lib/karafka/pro/processing/jobs_queue.rb +2 -10
- data/lib/karafka/pro/processing/offset_metadata/consumer.rb +2 -10
- data/lib/karafka/pro/processing/offset_metadata/fetcher.rb +2 -10
- data/lib/karafka/pro/processing/offset_metadata/listener.rb +2 -10
- data/lib/karafka/pro/processing/partitioner.rb +35 -24
- data/lib/karafka/pro/processing/periodic_job/consumer.rb +2 -10
- data/lib/karafka/pro/processing/piping/consumer.rb +2 -10
- data/lib/karafka/pro/processing/schedulers/base.rb +2 -10
- data/lib/karafka/pro/processing/schedulers/default.rb +3 -10
- data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_lrj_mom.rb +3 -11
- data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_lrj_mom_vp.rb +3 -11
- data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/dlq_ftr_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom.rb +3 -11
- data/lib/karafka/pro/processing/strategies/aj/dlq_lrj_mom_vp.rb +3 -11
- data/lib/karafka/pro/processing/strategies/aj/dlq_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/dlq_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/ftr_lrj_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/ftr_lrj_mom_vp.rb +3 -11
- data/lib/karafka/pro/processing/strategies/aj/ftr_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/ftr_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/lrj_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/lrj_mom_vp.rb +5 -13
- data/lib/karafka/pro/processing/strategies/aj/mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/aj/mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/base.rb +2 -10
- data/lib/karafka/pro/processing/strategies/default.rb +140 -58
- data/lib/karafka/pro/processing/strategies/dlq/default.rb +23 -15
- data/lib/karafka/pro/processing/strategies/dlq/ftr.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj.rb +3 -11
- data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom.rb +7 -11
- data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/ftr_lrj_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/ftr_mom.rb +19 -11
- data/lib/karafka/pro/processing/strategies/dlq/ftr_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/ftr_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/lrj.rb +3 -11
- data/lib/karafka/pro/processing/strategies/dlq/lrj_mom.rb +19 -11
- data/lib/karafka/pro/processing/strategies/dlq/lrj_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/lrj_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/mom.rb +24 -16
- data/lib/karafka/pro/processing/strategies/dlq/mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/dlq/vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/ftr/default.rb +17 -12
- data/lib/karafka/pro/processing/strategies/ftr/vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/lrj/default.rb +5 -13
- data/lib/karafka/pro/processing/strategies/lrj/ftr.rb +3 -11
- data/lib/karafka/pro/processing/strategies/lrj/ftr_mom.rb +2 -10
- data/lib/karafka/pro/processing/strategies/lrj/ftr_mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/lrj/ftr_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/lrj/mom.rb +4 -12
- data/lib/karafka/pro/processing/strategies/lrj/mom_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/lrj/vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/mom/default.rb +2 -10
- data/lib/karafka/pro/processing/strategies/mom/ftr.rb +2 -10
- data/lib/karafka/pro/processing/strategies/mom/ftr_vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/mom/vp.rb +2 -10
- data/lib/karafka/pro/processing/strategies/vp/default.rb +5 -10
- data/lib/karafka/pro/processing/strategies.rb +2 -10
- data/lib/karafka/pro/processing/strategy_selector.rb +2 -10
- data/lib/karafka/pro/processing/subscription_groups_coordinator.rb +2 -10
- data/lib/karafka/pro/recurring_tasks/consumer.rb +97 -0
- data/lib/karafka/pro/recurring_tasks/contracts/config.rb +45 -0
- data/lib/karafka/pro/recurring_tasks/contracts/task.rb +33 -0
- data/lib/karafka/pro/recurring_tasks/deserializer.rb +27 -0
- data/lib/karafka/pro/recurring_tasks/dispatcher.rb +79 -0
- data/lib/karafka/pro/recurring_tasks/errors.rb +26 -0
- data/lib/karafka/pro/recurring_tasks/executor.rb +144 -0
- data/lib/karafka/pro/recurring_tasks/listener.rb +30 -0
- data/lib/karafka/pro/recurring_tasks/matcher.rb +30 -0
- data/lib/karafka/pro/recurring_tasks/schedule.rb +55 -0
- data/lib/karafka/pro/recurring_tasks/serializer.rb +105 -0
- data/lib/karafka/pro/recurring_tasks/setup/config.rb +44 -0
- data/lib/karafka/pro/recurring_tasks/task.rb +143 -0
- data/lib/karafka/pro/recurring_tasks.rb +79 -0
- data/lib/karafka/pro/routing/features/active_job/builder.rb +2 -10
- data/lib/karafka/pro/routing/features/active_job.rb +2 -10
- data/lib/karafka/pro/routing/features/adaptive_iterator/config.rb +26 -0
- data/lib/karafka/pro/routing/features/adaptive_iterator/contracts/topic.rb +66 -0
- data/lib/karafka/pro/routing/features/adaptive_iterator/topic.rb +54 -0
- data/lib/karafka/pro/routing/features/adaptive_iterator.rb +23 -0
- data/lib/karafka/pro/routing/features/base.rb +2 -10
- data/lib/karafka/pro/routing/features/dead_letter_queue/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/dead_letter_queue/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/dead_letter_queue.rb +2 -10
- data/lib/karafka/pro/routing/features/delaying/config.rb +2 -10
- data/lib/karafka/pro/routing/features/delaying/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/delaying/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/delaying.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments/config.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments/contracts/consumer_group.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments/subscription_group.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/direct_assignments.rb +2 -10
- data/lib/karafka/pro/routing/features/expiring/config.rb +2 -10
- data/lib/karafka/pro/routing/features/expiring/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/expiring/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/expiring.rb +2 -10
- data/lib/karafka/pro/routing/features/filtering/config.rb +2 -10
- data/lib/karafka/pro/routing/features/filtering/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/filtering/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/filtering.rb +2 -10
- data/lib/karafka/pro/routing/features/inline_insights/config.rb +2 -10
- data/lib/karafka/pro/routing/features/inline_insights/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/inline_insights/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/inline_insights.rb +2 -10
- data/lib/karafka/pro/routing/features/long_running_job/config.rb +2 -10
- data/lib/karafka/pro/routing/features/long_running_job/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/long_running_job/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/long_running_job.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/config.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/patches/contracts/consumer_group.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/proxy.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/subscription_group.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing/subscription_groups_builder.rb +2 -10
- data/lib/karafka/pro/routing/features/multiplexing.rb +2 -10
- data/lib/karafka/pro/routing/features/non_blocking_job/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/non_blocking_job.rb +2 -10
- data/lib/karafka/pro/routing/features/offset_metadata/config.rb +2 -10
- data/lib/karafka/pro/routing/features/offset_metadata/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/offset_metadata/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/offset_metadata.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/builder.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/config.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/consumer_group.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/contracts/consumer_group.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/contracts/pattern.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/detector.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/pattern.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/patterns.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns/topics.rb +2 -10
- data/lib/karafka/pro/routing/features/patterns.rb +2 -10
- data/lib/karafka/pro/routing/features/pausing/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/pausing/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/pausing.rb +2 -10
- data/lib/karafka/pro/routing/features/periodic_job/config.rb +2 -10
- data/lib/karafka/pro/routing/features/periodic_job/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/periodic_job/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/periodic_job.rb +2 -10
- data/lib/karafka/pro/routing/features/recurring_tasks/builder.rb +123 -0
- data/lib/karafka/pro/routing/features/recurring_tasks/config.rb +20 -0
- data/lib/karafka/pro/routing/features/recurring_tasks/contracts/topic.rb +32 -0
- data/lib/karafka/pro/routing/features/recurring_tasks/proxy.rb +19 -0
- data/lib/karafka/pro/routing/features/recurring_tasks/topic.rb +36 -0
- data/lib/karafka/pro/routing/features/recurring_tasks.rb +17 -0
- data/lib/karafka/pro/routing/features/scheduled_messages/builder.rb +123 -0
- data/lib/karafka/pro/routing/features/scheduled_messages/config.rb +20 -0
- data/lib/karafka/pro/routing/features/scheduled_messages/contracts/topic.rb +32 -0
- data/lib/karafka/pro/routing/features/scheduled_messages/proxy.rb +19 -0
- data/lib/karafka/pro/routing/features/scheduled_messages/topic.rb +36 -0
- data/lib/karafka/pro/routing/features/scheduled_messages.rb +16 -0
- data/lib/karafka/pro/routing/features/swarm/config.rb +2 -10
- data/lib/karafka/pro/routing/features/swarm/contracts/routing.rb +2 -10
- data/lib/karafka/pro/routing/features/swarm/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/swarm/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/swarm.rb +2 -10
- data/lib/karafka/pro/routing/features/throttling/config.rb +2 -10
- data/lib/karafka/pro/routing/features/throttling/contracts/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/throttling/topic.rb +2 -10
- data/lib/karafka/pro/routing/features/throttling.rb +2 -10
- data/lib/karafka/pro/routing/features/virtual_partitions/config.rb +3 -10
- data/lib/karafka/pro/routing/features/virtual_partitions/contracts/topic.rb +3 -10
- data/lib/karafka/pro/routing/features/virtual_partitions/topic.rb +10 -12
- data/lib/karafka/pro/routing/features/virtual_partitions.rb +2 -10
- data/lib/karafka/pro/scheduled_messages/consumer.rb +177 -0
- data/lib/karafka/pro/scheduled_messages/contracts/config.rb +48 -0
- data/lib/karafka/pro/scheduled_messages/contracts/message.rb +88 -0
- data/lib/karafka/pro/scheduled_messages/daily_buffer.rb +71 -0
- data/lib/karafka/pro/scheduled_messages/day.rb +37 -0
- data/lib/karafka/pro/scheduled_messages/deserializers/headers.rb +38 -0
- data/lib/karafka/pro/scheduled_messages/deserializers/payload.rb +27 -0
- data/lib/karafka/pro/scheduled_messages/dispatcher.rb +114 -0
- data/lib/karafka/pro/scheduled_messages/errors.rb +20 -0
- data/lib/karafka/pro/scheduled_messages/max_epoch.rb +33 -0
- data/lib/karafka/pro/scheduled_messages/proxy.rb +177 -0
- data/lib/karafka/pro/scheduled_messages/schema_validator.rb +29 -0
- data/lib/karafka/pro/scheduled_messages/serializer.rb +47 -0
- data/lib/karafka/pro/scheduled_messages/setup/config.rb +52 -0
- data/lib/karafka/pro/scheduled_messages/state.rb +54 -0
- data/lib/karafka/pro/scheduled_messages/tracker.rb +56 -0
- data/lib/karafka/pro/scheduled_messages.rb +59 -0
- data/lib/karafka/pro/swarm/liveness_listener.rb +2 -10
- data/lib/karafka/processing/coordinator.rb +14 -0
- data/lib/karafka/processing/executor.rb +29 -1
- data/lib/karafka/processing/jobs/base.rb +13 -0
- data/lib/karafka/processing/jobs/consume.rb +2 -0
- data/lib/karafka/processing/jobs/eofed.rb +29 -0
- data/lib/karafka/processing/jobs/idle.rb +2 -0
- data/lib/karafka/processing/jobs/revoked.rb +2 -0
- data/lib/karafka/processing/jobs/shutdown.rb +2 -0
- data/lib/karafka/processing/jobs_builder.rb +6 -0
- data/lib/karafka/processing/schedulers/default.rb +1 -0
- data/lib/karafka/processing/strategies/aj_dlq_mom.rb +1 -1
- data/lib/karafka/processing/strategies/default.rb +45 -13
- data/lib/karafka/processing/strategies/dlq.rb +19 -5
- data/lib/karafka/processing/strategies/dlq_mom.rb +27 -8
- data/lib/karafka/processing/worker.rb +26 -13
- data/lib/karafka/railtie.rb +11 -42
- data/lib/karafka/routing/builder.rb +19 -1
- data/lib/karafka/routing/consumer_group.rb +9 -14
- data/lib/karafka/routing/features/dead_letter_queue/config.rb +3 -0
- data/lib/karafka/routing/features/dead_letter_queue/contracts/topic.rb +1 -0
- data/lib/karafka/routing/features/dead_letter_queue/topic.rb +7 -2
- data/lib/karafka/routing/features/eofed/config.rb +15 -0
- data/lib/karafka/routing/features/eofed/contracts/topic.rb +39 -0
- data/lib/karafka/routing/features/eofed/topic.rb +31 -0
- data/lib/karafka/routing/features/eofed.rb +14 -0
- data/lib/karafka/routing/subscription_group.rb +29 -1
- data/lib/karafka/routing/topic.rb +24 -1
- data/lib/karafka/runner.rb +10 -9
- data/lib/karafka/server.rb +37 -1
- data/lib/karafka/setup/attributes_map.rb +11 -4
- data/lib/karafka/setup/config.rb +11 -52
- data/lib/karafka/setup/defaults_injector.rb +64 -0
- data/lib/karafka/swarm/node.rb +2 -0
- data/lib/karafka/swarm/supervisor.rb +11 -2
- data/lib/karafka/templates/karafka.rb.erb +2 -2
- data/lib/karafka/version.rb +1 -1
- data/lib/karafka.rb +47 -7
- data.tar.gz.sig +0 -0
- metadata +116 -33
- metadata.gz.sig +0 -0
- data/certs/cert_chain.pem +0 -26
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -89,6 +81,23 @@ module Karafka
|
|
|
89
81
|
applied.map(&:cursor).compact.min_by(&:offset)
|
|
90
82
|
end
|
|
91
83
|
|
|
84
|
+
# @return [Boolean] did any of the filters requested offset storage during filter
|
|
85
|
+
# application
|
|
86
|
+
def mark_as_consumed?
|
|
87
|
+
# We can manage filtering offset only when user wanted that and there is a cursor
|
|
88
|
+
# to use
|
|
89
|
+
applied.any?(&:mark_as_consumed?) && cursor
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @return [Symbol] `:mark_as_consumed` or `:mark_as_consumed!`
|
|
93
|
+
def marking_method
|
|
94
|
+
candidates = applied.map(&:marking_method)
|
|
95
|
+
|
|
96
|
+
return :mark_as_consumed! if candidates.include?(:mark_as_consumed!)
|
|
97
|
+
|
|
98
|
+
:mark_as_consumed
|
|
99
|
+
end
|
|
100
|
+
|
|
92
101
|
private
|
|
93
102
|
|
|
94
103
|
# @return [Boolean] is filtering active
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -25,6 +17,7 @@ module Karafka
|
|
|
25
17
|
expansions = super
|
|
26
18
|
expansions << Pro::Processing::Piping::Consumer
|
|
27
19
|
expansions << Pro::Processing::OffsetMetadata::Consumer if topic.offset_metadata?
|
|
20
|
+
expansions << Pro::Processing::AdaptiveIterator::Consumer if topic.adaptive_iterator?
|
|
28
21
|
expansions << Pro::Processing::PeriodicJob::Consumer if topic.periodic_job?
|
|
29
22
|
expansions
|
|
30
23
|
end
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -54,6 +46,18 @@ module Karafka
|
|
|
54
46
|
def timeout
|
|
55
47
|
0
|
|
56
48
|
end
|
|
49
|
+
|
|
50
|
+
# @return [Boolean] should we use the cursor value to mark as consumed. If any of the
|
|
51
|
+
# filters returns true, we return lowers applicable cursor value (if any)
|
|
52
|
+
def mark_as_consumed?
|
|
53
|
+
false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @return [Symbol] `:mark_as_consumed` or `:mark_as_consumed!`. Applicable only if
|
|
57
|
+
# marking is requested
|
|
58
|
+
def marking_method
|
|
59
|
+
:mark_as_consumed
|
|
60
|
+
end
|
|
57
61
|
end
|
|
58
62
|
end
|
|
59
63
|
end
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -33,7 +25,7 @@ module Karafka
|
|
|
33
25
|
|
|
34
26
|
# Time on message is in seconds with ms precision, so we need to convert the ttl that
|
|
35
27
|
# is in ms to this format
|
|
36
|
-
border = ::Time.now.utc - @delay / 1_000.
|
|
28
|
+
border = ::Time.now.utc - @delay / 1_000.0
|
|
37
29
|
|
|
38
30
|
messages.delete_if do |message|
|
|
39
31
|
too_young = message.timestamp > border
|
|
@@ -52,7 +44,7 @@ module Karafka
|
|
|
52
44
|
def timeout
|
|
53
45
|
return 0 unless @cursor
|
|
54
46
|
|
|
55
|
-
timeout = (@delay / 1_000.
|
|
47
|
+
timeout = (@delay / 1_000.0) - (::Time.now.utc - @cursor.timestamp)
|
|
56
48
|
|
|
57
49
|
timeout <= 0 ? 0 : timeout * 1_000
|
|
58
50
|
end
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -26,6 +18,8 @@ module Karafka
|
|
|
26
18
|
# @note It needs to be working with a proper consumer that will handle the partition
|
|
27
19
|
# management. This layer of the framework knows nothing about Kafka messages consumption.
|
|
28
20
|
class ConsumeNonBlocking < ::Karafka::Processing::Jobs::Consume
|
|
21
|
+
self.action = :consume
|
|
22
|
+
|
|
29
23
|
# Makes this job non-blocking from the start
|
|
30
24
|
# @param args [Array] any arguments accepted by `::Karafka::Processing::Jobs::Consume`
|
|
31
25
|
def initialize(*args)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
5
|
+
|
|
6
|
+
module Karafka
|
|
7
|
+
module Pro
|
|
8
|
+
module Processing
|
|
9
|
+
module Jobs
|
|
10
|
+
# Non-Blocking version of the Eofed job
|
|
11
|
+
# We use this version for LRJ topics for cases where saturated resources would not allow
|
|
12
|
+
# to run this job for extended period of time. Under such scenarios, if we would not use
|
|
13
|
+
# a non-blocking one, we would reach max.poll.interval.ms.
|
|
14
|
+
class EofedNonBlocking < ::Karafka::Processing::Jobs::Eofed
|
|
15
|
+
self.action = :eofed
|
|
16
|
+
|
|
17
|
+
# @param args [Array] any arguments accepted by `::Karafka::Processing::Jobs::Eofed`
|
|
18
|
+
def initialize(*args)
|
|
19
|
+
super
|
|
20
|
+
@non_blocking = true
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -18,6 +10,8 @@ module Karafka
|
|
|
18
10
|
# Job that represents a "ticking" work. Work that we run periodically for the Periodics
|
|
19
11
|
# enabled topics.
|
|
20
12
|
class Periodic < ::Karafka::Processing::Jobs::Base
|
|
13
|
+
self.action = :tick
|
|
14
|
+
|
|
21
15
|
# @param executor [Karafka::Pro::Processing::Executor] pro executor that is suppose to
|
|
22
16
|
# run a given job
|
|
23
17
|
def initialize(executor)
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -20,6 +12,8 @@ module Karafka
|
|
|
20
12
|
# to run this job for extended period of time. Under such scenarios, if we would not use
|
|
21
13
|
# a non-blocking one, we would reach max.poll.interval.ms.
|
|
22
14
|
class PeriodicNonBlocking < Periodic
|
|
15
|
+
self.action = :tick
|
|
16
|
+
|
|
23
17
|
# @param args [Array] any arguments accepted by `::Karafka::Processing::Jobs::Periodic`
|
|
24
18
|
def initialize(*args)
|
|
25
19
|
super
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -24,6 +16,8 @@ module Karafka
|
|
|
24
16
|
# in scenarios where there are more jobs than threads, without this being async we
|
|
25
17
|
# would potentially stop polling
|
|
26
18
|
class RevokedNonBlocking < ::Karafka::Processing::Jobs::Revoked
|
|
19
|
+
self.action = :revoked
|
|
20
|
+
|
|
27
21
|
# Makes this job non-blocking from the start
|
|
28
22
|
# @param args [Array] any arguments accepted by `::Karafka::Processing::Jobs::Revoked`
|
|
29
23
|
def initialize(*args)
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -33,6 +25,18 @@ module Karafka
|
|
|
33
25
|
end
|
|
34
26
|
end
|
|
35
27
|
|
|
28
|
+
# @param executor [Karafka::Pro::Processing::Executor]
|
|
29
|
+
# @return [Karafka::Processing::Jobs::Eofed] eofed job for non LRJ
|
|
30
|
+
# @return [Karafka::Processing::Jobs::EofedBlocking] eofed job that is
|
|
31
|
+
# non-blocking, so when revocation job is scheduled for LRJ it also will not block
|
|
32
|
+
def eofed(executor)
|
|
33
|
+
if executor.topic.long_running_job?
|
|
34
|
+
Jobs::EofedNonBlocking.new(executor)
|
|
35
|
+
else
|
|
36
|
+
super
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
36
40
|
# @param executor [Karafka::Pro::Processing::Executor]
|
|
37
41
|
# @return [Karafka::Processing::Jobs::Revoked] revocation job for non LRJ
|
|
38
42
|
# @return [Karafka::Processing::Jobs::RevokedNonBlocking] revocation job that is
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -25,10 +17,13 @@ module Karafka
|
|
|
25
17
|
def call(topic, messages, coordinator)
|
|
26
18
|
ktopic = @subscription_group.topics.find(topic)
|
|
27
19
|
|
|
20
|
+
vps = ktopic.virtual_partitions
|
|
21
|
+
|
|
28
22
|
# We only partition work if we have:
|
|
29
23
|
# - a virtual partitioner
|
|
30
24
|
# - more than one thread to process the data
|
|
31
25
|
# - collective is not collapsed via coordinator
|
|
26
|
+
# - none of the partitioner executions raised an error
|
|
32
27
|
#
|
|
33
28
|
# With one thread it is not worth partitioning the work as the work itself will be
|
|
34
29
|
# assigned to one thread (pointless work)
|
|
@@ -38,21 +33,37 @@ module Karafka
|
|
|
38
33
|
#
|
|
39
34
|
# This is great because it allows us to run things without the parallelization that adds
|
|
40
35
|
# a bit of uncertainty and allows us to use DLQ and safely skip messages if needed.
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
if vps.active? && vps.max_partitions > 1 && !coordinator.collapsed?
|
|
37
|
+
# If we cannot virtualize even one message from a given batch due to user errors, we
|
|
38
|
+
# reduce the whole set into one partition and emit error. This should still allow for
|
|
39
|
+
# user flow but should mitigate damages by not virtualizing
|
|
40
|
+
begin
|
|
41
|
+
groupings = messages.group_by do |msg|
|
|
42
|
+
# We need to reduce it to the max concurrency, so the group_id is not a direct
|
|
43
|
+
# effect of the end user action. Otherwise the persistence layer for consumers
|
|
44
|
+
# would cache it forever and it would cause memory leaks
|
|
45
|
+
#
|
|
46
|
+
# This also needs to be consistent because the aggregation here needs to warrant,
|
|
47
|
+
# that the same partitioned message will always be assigned to the same virtual
|
|
48
|
+
# partition. Otherwise in case of a window aggregation with VP spanning across
|
|
49
|
+
# several polls, the data could not be complete.
|
|
50
|
+
vps.reducer.call(
|
|
51
|
+
vps.partitioner.call(msg)
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
rescue StandardError => e
|
|
55
|
+
# This should not happen. If you are seeing this it means your partitioner code
|
|
56
|
+
# failed and raised an error. We highly recommend mitigating partitioner level errors
|
|
57
|
+
# on the user side because this type of collapse should be considered a last resort
|
|
58
|
+
Karafka.monitor.instrument(
|
|
59
|
+
'error.occurred',
|
|
60
|
+
caller: self,
|
|
61
|
+
error: e,
|
|
62
|
+
messages: messages,
|
|
63
|
+
type: 'virtual_partitions.partitioner.error'
|
|
64
|
+
)
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
groupings = { 0 => messages }
|
|
56
67
|
end
|
|
57
68
|
|
|
58
69
|
groupings.each do |key, messages_group|
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# This
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
|
7
|
-
# repository and their usage requires commercial license agreement.
|
|
8
|
-
#
|
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
|
10
|
-
#
|
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
|
12
|
-
# your code to Maciej Mensfeld.
|
|
3
|
+
# This code is part of Karafka Pro, a commercial component not licensed under LGPL.
|
|
4
|
+
# See LICENSE for details.
|
|
13
5
|
|
|
14
6
|
module Karafka
|
|
15
7
|
module Pro
|