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
|
|
@@ -54,18 +46,30 @@ module Karafka
|
|
|
54
46
|
# already processed but rather at the next one. This applies to both sync and async
|
|
55
47
|
# versions of this method.
|
|
56
48
|
def mark_as_consumed(message, offset_metadata = @_current_offset_metadata)
|
|
49
|
+
# If we are inside a transaction than we can just mark as consumed within it
|
|
57
50
|
if @_in_transaction
|
|
58
51
|
mark_in_transaction(message, offset_metadata, true)
|
|
52
|
+
elsif @_in_transaction_marked
|
|
53
|
+
mark_in_memory(message)
|
|
59
54
|
else
|
|
60
55
|
# seek offset can be nil only in case `#seek` was invoked with offset reset request
|
|
61
56
|
# In case like this we ignore marking
|
|
62
|
-
return true if
|
|
57
|
+
return true if seek_offset.nil?
|
|
63
58
|
# Ignore earlier offsets than the one we already committed
|
|
64
|
-
return true if
|
|
59
|
+
return true if seek_offset > message.offset
|
|
65
60
|
return false if revoked?
|
|
66
|
-
return revoked? unless client.mark_as_consumed(message, offset_metadata)
|
|
67
61
|
|
|
68
|
-
|
|
62
|
+
# If we are not inside a transaction but this is a transactional topic, we mark with
|
|
63
|
+
# artificially created transaction
|
|
64
|
+
stored = if producer.transactional?
|
|
65
|
+
mark_with_transaction(message, offset_metadata, true)
|
|
66
|
+
else
|
|
67
|
+
client.mark_as_consumed(message, offset_metadata)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return revoked? unless stored
|
|
71
|
+
|
|
72
|
+
self.seek_offset = message.offset + 1
|
|
69
73
|
end
|
|
70
74
|
|
|
71
75
|
true
|
|
@@ -82,17 +86,27 @@ module Karafka
|
|
|
82
86
|
def mark_as_consumed!(message, offset_metadata = @_current_offset_metadata)
|
|
83
87
|
if @_in_transaction
|
|
84
88
|
mark_in_transaction(message, offset_metadata, false)
|
|
89
|
+
elsif @_in_transaction_marked
|
|
90
|
+
mark_in_memory(message)
|
|
85
91
|
else
|
|
86
92
|
# seek offset can be nil only in case `#seek` was invoked with offset reset request
|
|
87
93
|
# In case like this we ignore marking
|
|
88
|
-
return true if
|
|
94
|
+
return true if seek_offset.nil?
|
|
89
95
|
# Ignore earlier offsets than the one we already committed
|
|
90
|
-
return true if
|
|
96
|
+
return true if seek_offset > message.offset
|
|
91
97
|
return false if revoked?
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
# If we are not inside a transaction but this is a transactional topic, we mark with
|
|
100
|
+
# artificially created transaction
|
|
101
|
+
stored = if producer.transactional?
|
|
102
|
+
mark_with_transaction(message, offset_metadata, false)
|
|
103
|
+
else
|
|
104
|
+
client.mark_as_consumed!(message, offset_metadata)
|
|
105
|
+
end
|
|
94
106
|
|
|
95
|
-
|
|
107
|
+
return revoked? unless stored
|
|
108
|
+
|
|
109
|
+
self.seek_offset = message.offset + 1
|
|
96
110
|
end
|
|
97
111
|
|
|
98
112
|
true
|
|
@@ -112,7 +126,7 @@ module Karafka
|
|
|
112
126
|
# managing multiple producers. If not provided, default producer taken from `#producer`
|
|
113
127
|
# will be used.
|
|
114
128
|
#
|
|
115
|
-
# @
|
|
129
|
+
# @yield code that we want to run in a transaction
|
|
116
130
|
#
|
|
117
131
|
# @note Please note, that if you provide the producer, it will reassign the producer of
|
|
118
132
|
# the consumer for the transaction time. This means, that in case you would even
|
|
@@ -120,37 +134,57 @@ module Karafka
|
|
|
120
134
|
# reassigned producer and not the initially used/assigned producer. It is done that
|
|
121
135
|
# way, so the message producing aliases operate from within transactions and since the
|
|
122
136
|
# producer in transaction is locked, it will prevent other threads from using it.
|
|
123
|
-
def transaction(active_producer = producer
|
|
124
|
-
default_producer =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
def transaction(active_producer = producer)
|
|
138
|
+
default_producer = nil
|
|
139
|
+
transaction_started = nil
|
|
140
|
+
|
|
141
|
+
monitor.instrument('consumer.consuming.transaction', caller: self) do
|
|
142
|
+
default_producer = producer
|
|
143
|
+
self.producer = active_producer
|
|
144
|
+
|
|
145
|
+
transaction_started = false
|
|
146
|
+
|
|
147
|
+
# Prevent from nested transactions. It would not make any sense
|
|
148
|
+
raise Errors::TransactionAlreadyInitializedError if @_in_transaction
|
|
149
|
+
|
|
150
|
+
transaction_started = true
|
|
151
|
+
@_transaction_marked = []
|
|
152
|
+
@_in_transaction = true
|
|
153
|
+
@_in_transaction_marked = false
|
|
154
|
+
|
|
155
|
+
producer.transaction do
|
|
156
|
+
yield
|
|
157
|
+
|
|
158
|
+
# Ensure this transaction is rolled back if we have lost the ownership of this
|
|
159
|
+
# transaction. We do it only for transactions that contain offset management as for
|
|
160
|
+
# producer only, this is not relevant.
|
|
161
|
+
raise Errors::AssignmentLostError if @_in_transaction_marked && revoked?
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
@_in_transaction = false
|
|
165
|
+
|
|
166
|
+
# This offset is already stored in transaction but we set it here anyhow because we
|
|
167
|
+
# want to make sure our internal in-memory state is aligned with the transaction
|
|
168
|
+
#
|
|
169
|
+
# @note We never need to use the blocking `#mark_as_consumed!` here because the
|
|
170
|
+
# offset anyhow was already stored during the transaction
|
|
171
|
+
#
|
|
172
|
+
# @note Since the offset could have been already stored in Kafka (could have because
|
|
173
|
+
# you can have transactions without marking), we use the `@_in_transaction_marked`
|
|
174
|
+
# state to decide if we need to dispatch the offset via client at all
|
|
175
|
+
# (if post transaction, then we do not have to)
|
|
176
|
+
#
|
|
177
|
+
# @note In theory we could only keep reference to the most recent marking and reject
|
|
178
|
+
# others. We however do not do it for two reasons:
|
|
179
|
+
# - User may have non standard flow relying on some alternative order and we want
|
|
180
|
+
# to mimic this
|
|
181
|
+
# - Complex strategies like VPs can use this in VPs to mark in parallel without
|
|
182
|
+
# having to redefine the transactional flow completely
|
|
183
|
+
@_transaction_marked.each do |marking|
|
|
184
|
+
marking.pop ? mark_as_consumed(*marking) : mark_as_consumed!(*marking)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
true
|
|
154
188
|
end
|
|
155
189
|
ensure
|
|
156
190
|
self.producer = default_producer
|
|
@@ -158,6 +192,7 @@ module Karafka
|
|
|
158
192
|
if transaction_started
|
|
159
193
|
@_transaction_marked.clear
|
|
160
194
|
@_in_transaction = false
|
|
195
|
+
@_in_transaction_marked = false
|
|
161
196
|
end
|
|
162
197
|
end
|
|
163
198
|
|
|
@@ -178,13 +213,60 @@ module Karafka
|
|
|
178
213
|
offset_metadata
|
|
179
214
|
)
|
|
180
215
|
|
|
216
|
+
@_in_transaction_marked = true
|
|
181
217
|
@_transaction_marked ||= []
|
|
182
218
|
@_transaction_marked << [message, offset_metadata, async]
|
|
183
219
|
end
|
|
184
220
|
|
|
221
|
+
# @private
|
|
222
|
+
# @param message [Messages::Message] message we want to commit inside of a transaction
|
|
223
|
+
# @param offset_metadata [String, nil] offset metadata or nil if none
|
|
224
|
+
# @param async [Boolean] should we mark in async or sync way (applicable only to post
|
|
225
|
+
# transaction state synchronization usage as within transaction it is always sync)
|
|
226
|
+
# @return [Boolean] false if marking failed otherwise true
|
|
227
|
+
def mark_with_transaction(message, offset_metadata, async)
|
|
228
|
+
# This flag is used by VPs to differentiate between user initiated transactions and
|
|
229
|
+
# post-execution system transactions.
|
|
230
|
+
@_transaction_internal = true
|
|
231
|
+
|
|
232
|
+
transaction do
|
|
233
|
+
mark_in_transaction(message, offset_metadata, async)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
true
|
|
237
|
+
# We handle both cases here because this is a private API for internal usage and we want
|
|
238
|
+
# the post-user code execution marking with transactional producer to result in a
|
|
239
|
+
# boolean state of marking for further framework flow. This is a normalization to make it
|
|
240
|
+
# behave the same way as it would behave with a non-transactional one
|
|
241
|
+
rescue ::Rdkafka::RdkafkaError, Errors::AssignmentLostError
|
|
242
|
+
false
|
|
243
|
+
ensure
|
|
244
|
+
@_transaction_internal = false
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Marks the current state only in memory as the offset marking has already happened
|
|
248
|
+
# using the producer transaction
|
|
249
|
+
# @param message [Messages::Message] last successfully processed message.
|
|
250
|
+
# @return [Boolean] true if all good, false if we lost assignment and no point in marking
|
|
251
|
+
def mark_in_memory(message)
|
|
252
|
+
# seek offset can be nil only in case `#seek` was invoked with offset reset request
|
|
253
|
+
# In case like this we ignore marking
|
|
254
|
+
return true if seek_offset.nil?
|
|
255
|
+
# Ignore earlier offsets than the one we already committed
|
|
256
|
+
return true if seek_offset > message.offset
|
|
257
|
+
return false if revoked?
|
|
258
|
+
|
|
259
|
+
# If we have already marked this successfully in a transaction that was running
|
|
260
|
+
# we should not mark it again with the client offset delegation but instead we should
|
|
261
|
+
# just align the in-memory state
|
|
262
|
+
self.seek_offset = message.offset + 1
|
|
263
|
+
|
|
264
|
+
true
|
|
265
|
+
end
|
|
266
|
+
|
|
185
267
|
# No actions needed for the standard flow here
|
|
186
268
|
def handle_before_schedule_consume
|
|
187
|
-
|
|
269
|
+
monitor.instrument('consumer.before_schedule_consume', caller: self)
|
|
188
270
|
|
|
189
271
|
nil
|
|
190
272
|
end
|
|
@@ -203,8 +285,8 @@ module Karafka
|
|
|
203
285
|
# This can happen primarily when an LRJ job gets to the internal worker queue and
|
|
204
286
|
# this partition is revoked prior processing.
|
|
205
287
|
unless revoked?
|
|
206
|
-
|
|
207
|
-
|
|
288
|
+
monitor.instrument('consumer.consume', caller: self)
|
|
289
|
+
monitor.instrument('consumer.consumed', caller: self) do
|
|
208
290
|
consume
|
|
209
291
|
end
|
|
210
292
|
end
|
|
@@ -250,8 +332,8 @@ module Karafka
|
|
|
250
332
|
coordinator.revoke
|
|
251
333
|
end
|
|
252
334
|
|
|
253
|
-
|
|
254
|
-
|
|
335
|
+
monitor.instrument('consumer.revoke', caller: self)
|
|
336
|
+
monitor.instrument('consumer.revoked', caller: self) do
|
|
255
337
|
revoked
|
|
256
338
|
end
|
|
257
339
|
ensure
|
|
@@ -260,15 +342,15 @@ module Karafka
|
|
|
260
342
|
|
|
261
343
|
# No action needed for the tick standard flow
|
|
262
344
|
def handle_before_schedule_tick
|
|
263
|
-
|
|
345
|
+
monitor.instrument('consumer.before_schedule_tick', caller: self)
|
|
264
346
|
|
|
265
347
|
nil
|
|
266
348
|
end
|
|
267
349
|
|
|
268
350
|
# Runs the consumer `#tick` method with reporting
|
|
269
351
|
def handle_tick
|
|
270
|
-
|
|
271
|
-
|
|
352
|
+
monitor.instrument('consumer.tick', caller: self)
|
|
353
|
+
monitor.instrument('consumer.ticked', caller: self) do
|
|
272
354
|
tick
|
|
273
355
|
end
|
|
274
356
|
ensure
|
|
@@ -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
|
|
@@ -90,7 +82,7 @@ module Karafka
|
|
|
90
82
|
# information if this message was from marked offset or figured out via mom flow
|
|
91
83
|
def find_skippable_message
|
|
92
84
|
skippable_message = messages.find do |msg|
|
|
93
|
-
coordinator.marked? && msg.offset ==
|
|
85
|
+
coordinator.marked? && msg.offset == seek_offset
|
|
94
86
|
end
|
|
95
87
|
|
|
96
88
|
# If we don't have the message matching the last comitted offset, it means that
|
|
@@ -119,7 +111,7 @@ module Karafka
|
|
|
119
111
|
)
|
|
120
112
|
|
|
121
113
|
# Notify about dispatch on the events bus
|
|
122
|
-
|
|
114
|
+
monitor.instrument(
|
|
123
115
|
'dead_letter_queue.dispatched',
|
|
124
116
|
caller: self,
|
|
125
117
|
message: skippable_message
|
|
@@ -135,7 +127,12 @@ module Karafka
|
|
|
135
127
|
|
|
136
128
|
dispatch = lambda do
|
|
137
129
|
dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
|
|
138
|
-
|
|
130
|
+
|
|
131
|
+
if mark_after_dispatch?
|
|
132
|
+
mark_dispatched_to_dlq(skippable_message)
|
|
133
|
+
else
|
|
134
|
+
self.seek_offset = skippable_message.offset + 1
|
|
135
|
+
end
|
|
139
136
|
end
|
|
140
137
|
|
|
141
138
|
if dispatch_in_a_transaction?
|
|
@@ -154,11 +151,12 @@ module Karafka
|
|
|
154
151
|
topic: topic.dead_letter_queue.topic,
|
|
155
152
|
key: original_partition,
|
|
156
153
|
payload: skippable_message.raw_payload,
|
|
157
|
-
headers: skippable_message.
|
|
154
|
+
headers: skippable_message.raw_headers.merge(
|
|
158
155
|
'original_topic' => topic.name,
|
|
159
156
|
'original_partition' => original_partition,
|
|
160
157
|
'original_offset' => skippable_message.offset.to_s,
|
|
161
158
|
'original_consumer_group' => topic.consumer_group.id,
|
|
159
|
+
'original_key' => skippable_message.raw_key.to_s,
|
|
162
160
|
'original_attempts' => attempt.to_s
|
|
163
161
|
)
|
|
164
162
|
}
|
|
@@ -192,6 +190,16 @@ module Karafka
|
|
|
192
190
|
producer.transactional? && topic.dead_letter_queue.transactional?
|
|
193
191
|
end
|
|
194
192
|
|
|
193
|
+
# @return [Boolean] should we mark given message as consumed after dispatch.
|
|
194
|
+
# For default non MOM strategies if user did not explicitly tell us not to, we mark
|
|
195
|
+
# it. Default is `nil`, which means `true` in this case. If user provided alternative
|
|
196
|
+
# value, we go with it.
|
|
197
|
+
def mark_after_dispatch?
|
|
198
|
+
return true if topic.dead_letter_queue.mark_after_dispatch.nil?
|
|
199
|
+
|
|
200
|
+
topic.dead_letter_queue.mark_after_dispatch
|
|
201
|
+
end
|
|
202
|
+
|
|
195
203
|
# Runs the DLQ strategy and based on it it performs certain operations
|
|
196
204
|
#
|
|
197
205
|
# In case of `:skip` and `:dispatch` will run the exact flow provided in a block
|
|
@@ -218,7 +226,7 @@ module Karafka
|
|
|
218
226
|
coordinator.pause_tracker.reset
|
|
219
227
|
|
|
220
228
|
# Always backoff after DLQ dispatch even on skip to prevent overloads on errors
|
|
221
|
-
pause(
|
|
229
|
+
pause(seek_offset, nil, false)
|
|
222
230
|
end
|
|
223
231
|
|
|
224
232
|
# Marks message that went to DLQ (if applicable) based on the requested method
|
|
@@ -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
|
|
@@ -48,7 +40,7 @@ module Karafka
|
|
|
48
40
|
if coordinator.filtered? && !revoked?
|
|
49
41
|
handle_post_filtering
|
|
50
42
|
elsif !revoked? && !coordinator.manual_seek?
|
|
51
|
-
seek(
|
|
43
|
+
seek(seek_offset, false)
|
|
52
44
|
resume
|
|
53
45
|
else
|
|
54
46
|
resume
|
|
@@ -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
|
|
@@ -55,7 +47,11 @@ module Karafka
|
|
|
55
47
|
skippable_message, _marked = find_skippable_message
|
|
56
48
|
dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
|
|
57
49
|
|
|
58
|
-
|
|
50
|
+
if mark_after_dispatch?
|
|
51
|
+
mark_dispatched_to_dlq(skippable_message)
|
|
52
|
+
else
|
|
53
|
+
self.seek_offset = skippable_message.offset + 1
|
|
54
|
+
end
|
|
59
55
|
end
|
|
60
56
|
end
|
|
61
57
|
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
|
|
@@ -46,11 +38,27 @@ module Karafka
|
|
|
46
38
|
skippable_message, _marked = find_skippable_message
|
|
47
39
|
dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
if mark_after_dispatch?
|
|
42
|
+
mark_dispatched_to_dlq(skippable_message)
|
|
43
|
+
else
|
|
44
|
+
self.seek_offset = skippable_message.offset + 1
|
|
45
|
+
end
|
|
50
46
|
end
|
|
51
47
|
end
|
|
52
48
|
end
|
|
53
49
|
end
|
|
50
|
+
|
|
51
|
+
# @return [Boolean] should we mark given message as consumed after dispatch. For
|
|
52
|
+
# MOM strategies if user did not explicitly tell us to mark, we do not mark. Default
|
|
53
|
+
# is `nil`, which means `false` in this case. If user provided alternative value, we
|
|
54
|
+
# go with it.
|
|
55
|
+
#
|
|
56
|
+
# @note Please note, this is the opposite behavior than in case of AOM strategies.
|
|
57
|
+
def mark_after_dispatch?
|
|
58
|
+
return false if topic.dead_letter_queue.mark_after_dispatch.nil?
|
|
59
|
+
|
|
60
|
+
topic.dead_letter_queue.mark_after_dispatch
|
|
61
|
+
end
|
|
54
62
|
end
|
|
55
63
|
end
|
|
56
64
|
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
|
|
@@ -39,7 +31,7 @@ module Karafka
|
|
|
39
31
|
|
|
40
32
|
mark_as_consumed(last_group_message) unless revoked?
|
|
41
33
|
# We should not overwrite user manual seel request with our seek
|
|
42
|
-
seek(
|
|
34
|
+
seek(seek_offset, false) unless revoked? || coordinator.manual_seek?
|
|
43
35
|
|
|
44
36
|
resume
|
|
45
37
|
else
|
|
@@ -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
|
|
@@ -49,11 +41,27 @@ module Karafka
|
|
|
49
41
|
skippable_message, _marked = find_skippable_message
|
|
50
42
|
dispatch_to_dlq(skippable_message) if dispatch_to_dlq?
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
if mark_after_dispatch?
|
|
45
|
+
mark_dispatched_to_dlq(skippable_message)
|
|
46
|
+
else
|
|
47
|
+
self.seek_offset = skippable_message.offset + 1
|
|
48
|
+
end
|
|
53
49
|
end
|
|
54
50
|
end
|
|
55
51
|
end
|
|
56
52
|
end
|
|
53
|
+
|
|
54
|
+
# @return [Boolean] should we mark given message as consumed after dispatch. For
|
|
55
|
+
# MOM strategies if user did not explicitly tell us to mark, we do not mark. Default
|
|
56
|
+
# is `nil`, which means `false` in this case. If user provided alternative value, we
|
|
57
|
+
# go with it.
|
|
58
|
+
#
|
|
59
|
+
# @note Please note, this is the opposite behavior than in case of AOM strategies.
|
|
60
|
+
def mark_after_dispatch?
|
|
61
|
+
return false if topic.dead_letter_queue.mark_after_dispatch.nil?
|
|
62
|
+
|
|
63
|
+
topic.dead_letter_queue.mark_after_dispatch
|
|
64
|
+
end
|
|
57
65
|
end
|
|
58
66
|
end
|
|
59
67
|
end
|