You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Add a RabbitMQ service to the LCFS docker-compose.yml for local development. This RabbitMQ instance will simulate the message queue, allowing LCFS to test receiving transaction messages from TFRS. A script should be provided to easily add messages with the organization ID and compliance units for testing purposes.
Purpose:
To enable local development and testing of LCFS without requiring access to TFRS by simulating RabbitMQ messages locally.
Development Requirements:
Add RabbitMQ service to the LCFS docker-compose.yml.
Create a script that sends a message with an organization ID and compliance units to RabbitMQ.
Ensure LCFS can receive and process the message locally for testing.
Acceptance Criteria:
RabbitMQ instance is running in LCFS local development environment.
A script can successfully send a message to the RabbitMQ queue, and LCFS can receive and process the message.
importpikaimportjsondefsend_message(organization_id, compliance_units_amount):
# Setup connection and channelconnection=pika.BlockingConnection(pika.ConnectionParameters(host='localhost', port=5672))
channel=connection.channel()
# Declare the queue if not already declaredchannel.queue_declare(queue='transaction_queue', durable=True)
# Create the message bodymessage= {
'organization_id': organization_id,
'compliance_units_amount': compliance_units_amount
}
# Publish the message to the queuechannel.basic_publish(
exchange='',
routing_key='transaction_queue',
body=json.dumps(message),
properties=pika.BasicProperties(
delivery_mode=2, # Make message persistent
)
)
print(f" [x] Sent message: {message}")
# Close the connectionconnection.close()
if__name__=="__main__":
send_message(organization_id=1, compliance_units_amount=1000)
Explanation:
RabbitMQ Setup in Docker Compose: The RabbitMQ service has been added with default ports for management (15672) and communication (5672).
Script: This Python script uses pika to send a message to the RabbitMQ queue. It simulates a transaction message by sending an organization_id and compliance_units_amount to the transaction_queue queue. You can modify these values for testing purposes.
The text was updated successfully, but these errors were encountered:
Description:
Add a RabbitMQ service to the LCFS
docker-compose.yml
for local development. This RabbitMQ instance will simulate the message queue, allowing LCFS to test receiving transaction messages from TFRS. A script should be provided to easily add messages with the organization ID and compliance units for testing purposes.Purpose:
To enable local development and testing of LCFS without requiring access to TFRS by simulating RabbitMQ messages locally.
Development Requirements:
docker-compose.yml
.Acceptance Criteria:
Add rabbitmq to
docker-compose.yml
for LCFS:Script to Add a Message to RabbitMQ Queue:
Explanation:
15672
) and communication (5672
).pika
to send a message to the RabbitMQ queue. It simulates a transaction message by sending anorganization_id
andcompliance_units_amount
to thetransaction_queue
queue. You can modify these values for testing purposes.The text was updated successfully, but these errors were encountered: