Skip to content

Conversation

@iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Nov 13, 2024

Changelog Description

Added support for sender type.

Additional information

Added new methods get_sender_type and set_sender_type. And added more available filters to enroll_event_job.
We don't need to wait for backend PR to be merged if it won't change drastically.

Testing notes:

Can be tested with ynput/ayon-backend#399 .

  1. Create ServerAPI object.
  2. Set sender type to some string (e.g. "testSender").
  3. Modify an entity.
  4. Event triggered by the modification should contain the sender type.
  5. Enroll event for the entity change event with target topic "test1".
  6. You should get the event.
  7. Enroll event for the entity change event with target topic "test2" and ignored sender type with value from 2.
  8. You should not get the event.

Example python script

from ayon_api import ServerAPI

TEST_TOPIC = "test.enroll.topic"

api = ServerAPI(...)
api.set_sender_type("testSender")
api.dispatch_event(
    TEST_TOPIC,
    payload={"test": "test"},
)

job1 = api.enroll_event_job(
    TEST_TOPIC,
    "test1",
    "testSender1",
)
job2 = api.enroll_event_job(
    TEST_TOPIC,
    "test2",
    "testSender1",
    ignore_sender_types=["testSender"],
)
print(job1)  # Expect job
print(job2)  # Expect None

Resolves #201

@iLLiCiTiT iLLiCiTiT added the type: enhancement New feature or request label Nov 13, 2024
@iLLiCiTiT iLLiCiTiT self-assigned this Nov 13, 2024
@iLLiCiTiT iLLiCiTiT merged commit 7f6bfd5 into develop Nov 19, 2024
2 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancemet/201-implement-sender-type-support branch November 22, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement sender type support

2 participants