Skip to content

Add MskHook - #69000

Open
arnoldmr01 wants to merge 3 commits into
apache:mainfrom
arnoldmr01:add-hook-for-amazonmsk
Open

Add MskHook#69000
arnoldmr01 wants to merge 3 commits into
apache:mainfrom
arnoldmr01:add-hook-for-amazonmsk

Conversation

@arnoldmr01

@arnoldmr01arnoldmr01 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

Integrate Amazon MSK for user to have variety way to implement Event-Driven Scheduling feature which has been introduced in Airflow 3.0
related: #52712

What is changed in this PR?

This PR add a hook for Amazon MSK. We only make this hook as an interface for creating an authenticated MSK boto3 client so far.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
  • Codex

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@arnoldmr01
arnoldmr01 marked this pull request as ready for review June 30, 2026 07:32

@o-nikolaso-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the methods look like single line wrappers around the boto API. It seems like we don't have much of a usecase for this? Curious to hear what @vincbeck and @ferruzzi have to say about this one.

Comment threadproviders/amazon/pyproject.toml Outdated
# in the `devel-dependencies` section to be the same minimum version.
"boto3>=1.41.0",
"botocore>=1.41.0",
"aws-msk-iam-sasl-signer-python>=1.0.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of this is optional in the code as you've written it, but it's included as a mandatory dependency here. Let's move this below to be an optional dependency

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will modify it later

@o-nikolaso-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd probably have to bump the botocore minimum since these are new APIs?

@github-actions

Copy link
Copy Markdown
Contributor

uv.lock on main just moved via #68933 ("[main] Upgrade important CI environment"), commit e0a1726 and this PR currently conflicts.

Quickest fix:

git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-lease

Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future uv.lock bumps.

@arnoldmr01
arnoldmr01 marked this pull request as draft July 1, 2026 03:44
@ferruzzi

Copy link
Copy Markdown
Contributor

Agreed with Niko. Looks like the hooks are generally replacing one-liners with functions, which we generally avoid.

@jason810496jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM overall.

Most of the methods look like single line wrappers around the boto API. It seems like we don't have much of a usecase for this?

I agreed with this point as well. We could make the MSK Hook itself just the interface to retrieve the authenticated MSK client with given conn_id.

Same as the AwaitMessageTrigger (the Kafka concusmer in Airlfow trigger) implementation, we will leverage the SDK client that retrieved via connection directly without additional wrapper.

asyncdefrun(self):
consumer_hook=KafkaConsumerHook(topics=self.topics, kafka_config_id=self.kafka_config_id)
async_get_consumer=sync_to_async(consumer_hook.get_consumer)
self._consumer=awaitasync_get_consumer()
async_poll=sync_to_async(self._consumer.poll)
async_commit=sync_to_async(self._consumer.commit)

@vincbeckvincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I dont think these methods are needed. They do not add much value, in the task/operator you can directly invoke boto3 the same way you do it in the hook

@arnoldmr01

Copy link
Copy Markdown
ContributorAuthor

Thanks for reviewing. I agree that these methods are not necessary. I will follow @jason810496 comment and modify the PR and make it focus on retrieving authenticated MSK client

@arnoldmr01
arnoldmr01force-pushed the add-hook-for-amazonmsk branch 7 times, most recently from 016dcca to 3d68dddCompareJuly 20, 2026 07:12
@arnoldmr01
arnoldmr01 marked this pull request as ready for review July 20, 2026 07:54
@potiukpotiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 20, 2026

@jason810496jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, thanks.

@arnoldmr01

Copy link
Copy Markdown
ContributorAuthor

Thanks for your review

@arnoldmr01
arnoldmr01force-pushed the add-hook-for-amazonmsk branch from 10c4e68 to d4e2474CompareAugust 14, 2026 19:51
@arnoldmr01

Copy link
Copy Markdown
ContributorAuthor

Add confluent_token for confluent_kafka to connect with Amazon MSK

@eladkaleladkal changed the title Add hook for amazonmskAdd MskHookAug 21, 2026
@eladkal

Copy link
Copy Markdown
Contributor

I thought the task is to also add a trigger. Did I miss something?

@arnoldmr01

Copy link
Copy Markdown
ContributorAuthor

No, you're right. I will add the trigger in the follow-up PR

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providerskind:documentationprovider:amazonAWS/Amazon - related issuesready for maintainer reviewSet after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@arnoldmr01@ferruzzi@eladkal@o-nikolas@jason810496@vincbeck@potiuk