Skip to content

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 package com.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.).

java
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.

java
JsonObject result = Secretary.sendJobForImmediateExecutionSync(jobUUID, userUUID);

scheduleJob(jobUUID, userUUID, cronSchedule)

Schedules a documentAction job for recurring execution using a cron expression.

java
// Run daily at midnight
Secretary.scheduleJob(jobUUID, userUUID, "0 0 * * *");
  • Accepts Unix cron format (5 fields)
  • Validates syntax via cronutils library
  • 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.

java
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.

java
Secretary.sendZPLData(request, rawZplCommands, "label/danieln");

sendCRUDMessage(messageData, userUUID)

Sends generic MQTT CRUD operation messages for device synchronization.

java
Secretary.sendCRUDMessage(messageBuilder, userUUID);

Message Formats

Dispatcher Job (to boost.dispatcher.jobs)

json
{
  "jobType": "documentAction",
  "userUUID": "uuid",
  "tenantUUID": "uuid",
  "body": {
    "jobUUID": "uuid",
    "cronSchedule": "0 0 * * *"
  }
}

ZPL Print Job (via MQTT)

json
{
  "type": "application/zpl",
  "base64data": "<base64-encoded ZPL commands>",
  "printername": "ZebraPrinter"
}

Consumers (Controllers Using Secretary)

ControllerMethods UsedPurpose
SalesOrderControllerscheduleJob, sendJobForImmediateExecutionInvoice/document generation
SalesInvoiceControllerscheduleJob, sendJobForImmediateExecutionInvoice automation
PurchaseOrderControllerscheduleJob, sendJobForImmediateExecutionPO document generation
PrintControllersendZPL, sendZPLDataLabel printing
InventoryControllersendCRUDMessageDevice sync
FileControllersendJobForImmediateExecutionSyncThumbnail generation
DocumentApprovalFlowControllerJob schedulingWorkflow automation

Message Queue Destinations

Queue/TopicTarget ServicePurpose
boost.dispatcher.jobsBOOST.DispatcherJob scheduling & execution
boost.v3.thumbnailgeneratorBOOST.ThumbnailGeneratorImage thumbnail creation
MQTT topics (dynamic)BOOST.CloudPrinterZPL 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