This project demonstrates the Request-Reply pattern using RabbitMQ for message coordination between a workflow coordinator and worker processes, with PostgreSQL for state management.
docker run --name postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgresdocker exec -it postgres psql -U postgres -c "CREATE DATABASE workflowdb;"docker exec -it postgres psql -U postgres -d workflowdb -c "
CREATE TABLE work_items (
id SERIAL PRIMARY KEY,
status VARCHAR(50) NOT NULL DEFAULT 'Pending',
data TEXT,
started_at TIMESTAMP,
completed_at TIMESTAMP,
result TEXT
);
INSERT INTO work_items (status, data) VALUES
('Pending', 'Process customer order #1001'),
('Pending', 'Generate monthly report'),
('Pending', 'Send notification emails');
"docker exec -it postgres psql -U postgres -d workflowdb -c "SELECT * FROM work_items;"docker exec -it postgres psql -U postgres -d workflowdb -c "UPDATE work_items SET status = 'Pending', started_at = NULL, completed_at = NULL, result = NULL;"docker exec -it postgres psql -U postgres -d workflowdb -c "UPDATE work_items SET status = 'Pending', started_at = NULL, completed_at = NULL, result = NULL WHERE id = 1;"docker exec -it postgres psql -U postgres -d workflowdb -c "SELECT * FROM work_items;"docker exec -it postgres psql -U postgres -d workflowdb -c "SELECT * FROM work_items WHERE status = 'Pending';"The work item is not in 'Pending' status. Reset it using the database commands above.