BOOST.ThumbnailGenerator
A Java microservice that generates thumbnail images from various file formats (images, PDFs, etc.). It operates as a message queue consumer, receiving requests via AMQP/JMS, generating 200px PNG thumbnails, and responding with the result and image metadata.
Architecture
BOOST.ThumbnailGenerator runs as a standalone service that:
- Connects to an AMQP message broker
- Listens on the queue
boostv3.thumbnailgenerator - Receives file generation requests containing a pre-signed URL
- Downloads and processes the file using ImageMagick
- Responds via JMS with the thumbnail path and metadata
Prerequisites
- Java 21
- ImageMagick (must be installed and accessible on the system PATH)
- AMQP Message Broker (e.g., RabbitMQ)
Configuration
Configuration is defined in config.properties:
properties
broker_url=amqp://172.16.200.32:5672
message_queue_name=boostv3.thumbnailgenerator
source_path=c:/x
output_path=c:/x
log_file=| Property | Description |
|---|---|
broker_url | AMQP broker connection URL |
message_queue_name | Queue name to consume from |
source_path | Temporary directory for downloaded source files |
output_path | Root directory for generated thumbnails |
log_file | Optional log file path |
Message Format
Request (Incoming JMS Message)
json
{
"tenantUUID": "string",
"preSignedUrl": "string"
}| Field | Description |
|---|---|
tenantUUID | Tenant identifier for multi-tenant file organization |
preSignedUrl | Pre-signed URL to download the source file |
Response (JMS Reply)
json
{
"success": true,
"thumbnailFileName": "uuid.png",
"pathPrefix": "tenantUUID/2025-01",
"mimeType": "image/png",
"metaData": {
"width": 800,
"height": 600,
"format": "PNG",
"colorSpace": "sRGB",
"depth": 8
}
}| Field | Description |
|---|---|
success | Whether thumbnail generation succeeded |
thumbnailFileName | Generated thumbnail filename (UUID-based) |
pathPrefix | Storage path prefix: {tenantUUID}/{YYYY-MM} |
mimeType | Detected MIME type of the source file |
metaData | Extracted image properties |
Thumbnail Generation Process
- The source file is downloaded from the pre-signed URL via HTTP
- MIME type is detected using Apache Tika
- Image orientation (landscape/portrait) is determined via ImageMagick's
identifycommand - The image is resized to 200px (width for portrait, height for landscape) with a white background
- Output is saved as PNG in the path
{output_path}/{tenantUUID}/{YYYY-MM}/{uuid}.png - Source file is deleted after processing
File Organization
Generated thumbnails are organized by tenant and date:
{output_path}/
{tenantUUID}/
{YYYY-MM}/
{uuid}.pngDependencies
| Dependency | Version | Purpose |
|---|---|---|
qpid-jms-client | 2.5.0 | AMQP messaging client |
jakarta.jms-api | 3.1.0 | JMS API |
im4java | 1.4.0 | ImageMagick Java wrapper |
tika-core | 3.0.0 | MIME type detection |
okhttp | 4.12.0 | HTTP file downloads |
BoostMiddleware | internal | Shared BOOST utilities |
Json | internal | JSON handling |
Running the Service
bash
java -cp target/classes com.luqon.boost.thumbnailgenerator.ThumbnailServerThe service connects to the configured broker and blocks until stdin is closed.