This project implements a system for processing long-running batch jobs using Azure Service Bus Job functionality.
- Processing of long-running tasks (several hours to several days)
- Support for clients without public endpoints
- Guaranteed reliable message delivery
- Ability to process multiple jobs simultaneously
- Scalable architecture for high-volume processing
- Real-time job status monitoring
- Fault-tolerant design with automatic retries
- Azure Service Bus
- Batch Processing
- Distributed Systems
- Message Queue
- Asynchronous Processing
- Long-running Jobs
- Cloud Computing
- Enterprise Integration
- Microservices
- Scalable Architecture
- Fault Tolerance
- Python AsyncIO
- Message Broker
- Job Scheduling
- Cloud Native
- Large-scale data processing
- ETL operations
- Machine learning model training
- Video/image processing
- Report generation
- Data migration
- Batch analytics
- Document processing
graph TD
A[Batch Client] -->|Request + JobId| B[Request Queue]
B --> C[Server]
C -->|Process 4h~days| D[Batch Job]
C -->|Response| E[Response Queue]
E --> A
- Install required packages
git clone https://github.com/ampersandor/session-batch.git
cd session-batch
poetry shell
poetry install
export PYTHONPATH=$(pwd)
- Set environment variables
you can use .env file or set environment variables
export SERVICEBUS_CONNECTION_STRING="..."
export SERVICEBUS_REQUEST_QUEUE_NAME="..."
export SERVICEBUS_RESPONSE_QUEUE_NAME="..."
export BATCH_ACCOUNT_NAME="..."
export BATCH_ACCOUNT_KEY="..."
export BATCH_ACCOUNT_URL="..."
export BATCH_MOUNT_PATH="..."
export POOL_ID="..."
export REDIS_HOST="..."
export REDIS_PORT="..."
export REDIS_PASSWORD="..."
export PGSQL_USER="..."
export PGSQL_PASSWORD="..."
export PGSQL_DATABASE="..."
export PGSQL_PORT="..."
export PGSQL_URL="..."
export TEAMS_WEBHOOK_URL="..."
export SERVER_MOUNT_PATH="..."
export BLOB_URL="..."
poetry run python src/app/server.py
poetry run python src/app/client.py
- Session-based Message Processing
- Each request is processed with a unique session ID
- Responses are delivered to the correct client
- Asynchronous Processing
- Multiple jobs can be processed simultaneously
- Efficient resource utilization
- Error Handling
- Automatic recovery from network errors
- Prevention of message loss
- Messages are moved to dead letter queue when processing errors occur
- Python 3.10+
- Azure Service Bus
- asyncio
- Sessions must be enabled on Service Bus queues
- All messages must include a session ID
MIT License
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
Please submit any questions through GitHub Issues.