correlation.py 698 B

123456789101112131415161718
  1. # Copyright © 2023 Ingram Micro Inc. All rights reserved.
  2. from django.conf import settings
  3. def get_correlation_id(signal_type, cqrs_id, instance_pk, queue):
  4. """
  5. :param signal_type: Type of the signal for this message.
  6. :type signal_type: dj_cqrs.constants.SignalType
  7. :param cqrs_id: The unique CQRS identifier of the model.
  8. :type cqrs_id: str
  9. :param instance_pk: Primary key of the instance.
  10. :param queue: Queue to synchronize, defaults to None
  11. :type queue: str, optional
  12. """
  13. correlation_func = settings.CQRS.get('master', {}).get('correlation_function')
  14. if correlation_func:
  15. return correlation_func(signal_type, cqrs_id, instance_pk, queue)