Skip to content

Commit

Permalink
feat: add support to filter Subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
joaodaher committed May 24, 2023
1 parent c322509 commit b73b423
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions django_cloud_tasks/tasks/subscriber_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def set_up(cls):
min_backoff=cls.min_backoff or get_config("subscribers_min_backoff"),
max_backoff=cls.max_backoff or get_config("subscribers_max_backoff"),
expiration_ttl=cls.expiration_ttl or get_config("subscribers_expiration"),
message_filter=cls.subscription_filter(),
)

@classmethod
Expand Down Expand Up @@ -77,3 +78,8 @@ def subscription_url(cls) -> str:
@lru_cache()
def _get_subscriber_client(cls) -> CloudSubscriber:
return CloudSubscriber()

@classmethod
def subscription_filter(cls) -> str | None:
# Reference: https://cloud.google.com/pubsub/docs/subscription-message-filter#filtering_syntax
return None

0 comments on commit b73b423

Please sign in to comment.