BOOST.Secretary
A static utility class that routes job requests to message queues, manages scheduled job execution via cron expressions, and handles device communication (ZPL label printing via MQTT). It bridges the synchronous API layer with asynchronous backend services.
Note: Currently lives inside BOOST.ERP.Compute (
C:\src\BOOST.Middleware) in the packagecom.luqon.boost.secretary. Consider separating into its own project.
Architecture
Controllers (Sales, Purchase, Inventory, Files, Print)
↓
Secretary (static methods)
↓
┌───────────────────────┬──────────────────────┬─────────────────┐
│ boost.dispatcher.jobs │ boost.v3.thumbnail │ MQTT Topics │
│ (BOOST.Dispatcher) │ generator │ (Printers) │
│ │ (BOOST.Thumbnail │ │
│ │ Generator) │ │
└───────────────────────┴──────────────────────┴─────────────────┘API Methods
Job Execution
sendJobForImmediateExecution(jobUUID, userUUID)
Sends a documentAction job to BOOST.Dispatcher for immediate processing (PDF generation, email sending, etc.).
Response response = Secretary.sendJobForImmediateExecution(jobUUID, userUUID);sendJobForImmediateExecutionSync(jobUUID, userUUID)
Synchronous variant — sends a thumbnail generation job and waits for the response on a temporary reply queue.
JsonObject result = Secretary.sendJobForImmediateExecutionSync(jobUUID, userUUID);scheduleJob(jobUUID, userUUID, cronSchedule)
Schedules a documentAction job for recurring execution using a cron expression.
// Run daily at midnight
Secretary.scheduleJob(jobUUID, userUUID, "0 0 * * *");- Accepts Unix cron format (5 fields)
- Validates syntax via
cronutilslibrary - Converts to Quartz cron format before sending to dispatcher
Device Communication
sendZPL(request, itemName, barcode, size, price, topic)
Generates ZPL (Zebra Printer Language) commands for label printing and publishes via MQTT.
Secretary.sendZPL(request, "Product Name", "1234567890123", "500ml", "29.90", "label/shelf");- Formats item name across up to 3 lines (14 chars max per line)
- Includes barcode, price, and optional size
- Base64-encodes ZPL data for safe MQTT transmission
sendZPLData(request, zplString, topic)
Sends pre-constructed ZPL data directly to an MQTT topic.
Secretary.sendZPLData(request, rawZplCommands, "label/danieln");sendCRUDMessage(messageData, userUUID)
Sends generic MQTT CRUD operation messages for device synchronization.
Secretary.sendCRUDMessage(messageBuilder, userUUID);Message Formats
Dispatcher Job (to boost.dispatcher.jobs)
{
"jobType": "documentAction",
"userUUID": "uuid",
"tenantUUID": "uuid",
"body": {
"jobUUID": "uuid",
"cronSchedule": "0 0 * * *"
}
}ZPL Print Job (via MQTT)
{
"type": "application/zpl",
"base64data": "<base64-encoded ZPL commands>",
"printername": "ZebraPrinter"
}Consumers (Controllers Using Secretary)
| Controller | Methods Used | Purpose |
|---|---|---|
SalesOrderController | scheduleJob, sendJobForImmediateExecution | Invoice/document generation |
SalesInvoiceController | scheduleJob, sendJobForImmediateExecution | Invoice automation |
PurchaseOrderController | scheduleJob, sendJobForImmediateExecution | PO document generation |
PrintController | sendZPL, sendZPLData | Label printing |
InventoryController | sendCRUDMessage | Device sync |
FileController | sendJobForImmediateExecutionSync | Thumbnail generation |
DocumentApprovalFlowController | Job scheduling | Workflow automation |
Message Queue Destinations
| Queue/Topic | Target Service | Purpose |
|---|---|---|
boost.dispatcher.jobs | BOOST.Dispatcher | Job scheduling & execution |
boost.v3.thumbnailgenerator | BOOST.ThumbnailGenerator | Image thumbnail creation |
| MQTT topics (dynamic) | BOOST.CloudPrinter | ZPL label printing |
Technical Notes
- Stateless: All methods are static
- Lazy initialization: JMS connection created on first use
- Thread-safe: Reuses producers for efficiency
- Cron validation: Unix → Quartz format conversion with syntax checking
- Dependencies: Apache QPID JMS, cronutils, BOOST JSON libraries