Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add local dev container for consuming event-bus events #619

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

pwnage101
Copy link
Contributor

@pwnage101 pwnage101 commented Jan 10, 2025

ENT-9901

Testing

Launching the container:

(enterprise-access) ubuntu@ip-10-13-20-242:~/edx-repos/enterprise-access$ make dev.up
...
 ✔ Container enterprise_access.consume_enterprise_subsidies_transaction_lifecycle  Started                                                                                                                                                                                         0.3s 

Container logs after launch:

(enterprise-access) ubuntu@ip-10-13-20-242:~/edx-repos/enterprise-access$ make consume_enterprise_subsidies_transaction_lifecycle-logs
...
enterprise_access.consume_enterprise_subsidies_transaction_lifecycle  | 2025-01-10 19:55:14,558 INFO 7 [edx_event_bus_kafka.internal.consumer] [user None] [ip None] [request_id None] consumer.py:284 - Running consumer for {'full_topic': 'dev-enterprise-subsidies-transaction-lifecycle', 'consumer_group': 'enterprise_access_dev'}

Container logs after emitting a TRANSACTION_REVERSED event from enterprise-subsidy:

enterprise_access.consume_enterprise_subsidies_transaction_lifecycle  | 2025-01-10 19:57:44,638 INFO 7 [edx_event_bus_kafka.internal.consumer] [user None] [ip None] [request_id None] consumer.py:513 - Message received from Kafka: topic=dev-enterprise-subsidies-transaction-lifecycle, partition=0, offset=29, message_id=28559382-cf8d-11ef-82b5-0242ac120020, key=b'\x00\x00\x00\x00\x01H7382cea3-6a3a-430f-9251-ee791cdab25e', event_timestamp_ms=1736539064581
enterprise_access.consume_enterprise_subsidies_transaction_lifecycle  | 2025-01-10 19:57:44,639 INFO 7 [enterprise_access.apps.content_assignments.signals] [user None] [ip None] [request_id None] signals.py:53 - No LearnerContentAssignment exists with transaction uuid: 7382cea3-6a3a-430f-9251-ee791cdab25e
enterprise_access.consume_enterprise_subsidies_transaction_lifecycle  | 2025-01-10 19:57:44,639 INFO 7 [edx_event_bus_kafka.internal.consumer] [user None] [ip None] [request_id None] consumer.py:393 - Message from Kafka processed successfully

Comment on lines +94 to +100
CELERY_ALWAYS_EAGER: 'false'
CELERY_BROKER_TRANSPORT: redis
CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379
CELERY_BROKER_VHOST: 0
CELERY_BROKER_PASSWORD: password
DJANGO_SETTINGS_MODULE: enterprise_access.settings.devstack
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this consumer need celery? If so, should we add worker to the depends_on above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not check, but figured it would not hurt. I also wanted to provide an easily copy-pasteable section for new consumers that might use celery. In service of that goal, I think adding worker to depends_on is a good idea.

@pwnage101 pwnage101 merged commit 823df3a into main Jan 13, 2025
3 checks passed
@pwnage101 pwnage101 deleted the pwnage101/ENT-9901 branch January 13, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants