Skip to content

BoostMiddleware ​

A shared Java library that provides an RPC-over-JMS framework for the BOOST microservice ecosystem. Services consume this library to register handler methods that process incoming message queue requests and return responses.

Architecture ​

AMQP Broker (ActiveMQ)
       ↓
   Server (MessageListener)
       ↓
   Request.parse(message)
       ↓
   Method Registry lookup
       ↓
   method.execute(request)
       ↓
   Response → JMS ReplyTo queue

Core Abstractions ​

ClassPurpose
ServerJMS queue listener, manages method registration and message routing
RequestIncoming message wrapper (auth, tenantID, userID, method, body)
ResponseOutgoing result with HTTP-like status codes
MethodInterface for handler implementations
ServerPropertiesConfiguration singleton

Usage ​

Registering Methods ​

java
Server server = new Server("boost.myservice.messages");

server.register("createItem", new Method() {
    @Override
    public Response execute(Request request) {
        Arguments args = Arguments.getArguments(request);
        String name = Arguments.getStringArgument(args, "name");
        int qty = Arguments.getIntArgument(args, "quantity", 0);
        // business logic...
        return Response.ok("Item created");
    }
});

Request Structure ​

Incoming JMS messages are JSON with the following fields:

FieldDescription
authBase64-encoded Basic Auth credentials
timestampRequest timestamp
userIDRequesting user UUID
tenantIDTenant UUID
methodRegistered method name to invoke
bodyJSON payload with method arguments

Response Builders ​

java
Response.ok(data)                  // 200
Response.bad(message)              // 400
Response.authenticationFailed()    // 401
Response.notFound()                // 404
Response.conflict(message)         // 409
Response.serverError(message)      // 500

Arguments Helper ​

Type-safe extraction from request body:

java
Arguments args = Arguments.getArguments(request);

String name    = Arguments.getStringArgument(args, "name");
int count      = Arguments.getIntArgument(args, "count", 0);
long id        = Arguments.getLongArgument(args, "id");
double price   = Arguments.getDoubleArgument(args, "price", 0.0);
boolean active = Arguments.getBooleanArgument(args, "active", false);
BigDecimal amt = Arguments.getBigDecimalArgument(args, "amount");
JsonObject obj = Arguments.getJsonObjectArgument(args, "details");
JsonArray arr  = Arguments.getJsonArrayArgument(args, "items");

Extension Points ​

MethodPurpose
isAuthenticated(Request)Override for custom authentication logic
handleException(Exception)Override for custom error handling

Utility Classes ​

ClassFunctionality
BasicAuthDecode Base64 Basic Auth headers
StringUtilsParsing, comma-split, random password generation (Base62)
Base62Base62 encoding for tokens
Base64UtilsBase64 encoding and random string generation
UuidUtilsUUID generation, validation, hyphen management
FunctionTimerNanosecond performance profiling
UtilsNull checks, constant-time equality, timestamp conversion

Configuration ​

config.properties ​

properties
broker_url=tcp://10.245.10.103:61616
redis_uri=10.245.10.30
mqtt_host=tcp://pmqtt01.westbahr.net:1883
mqtt_queue=sender.nimpos.messages
mqtt_username=bookaia
mqtt_password=****
log_file=

Known Consumers ​

  • BOOST.Integrations
  • BOOST.ThumbnailGenerator
  • PortalMiddleware (BOOST.APIGateway)
  • BOOST.NimposMiddleware
  • BOOST.FoodlyMiddleware

Dependencies ​

DependencyVersionPurpose
qpid-jms-client2.5.0AMQP protocol
paho.mqtt1.2.5MQTT protocol
okhttp4.12.0HTTP client
commons-codec1.15Encoding utilities
commons-daemon1.3.4Unix daemon support
slf4j + reload4j2.0.11Logging
protobuf-java3.22.0Serialization
Json (Luqon)internalJSON parsing/building

Project Structure ​

BoostMiddleware/
├── pom.xml
├── config.properties
├── hikari.properties
├── src/com/luqon/boost/middleware/
│   ├── Server.java
│   ├── Request.java
│   ├── Response.java
│   ├── Method.java
│   ├── ServerProperties.java
│   └── utils/
│       ├── Arguments.java
│       ├── BasicAuth.java
│       ├── Utils.java
│       ├── StringUtils.java
│       ├── Base62.java
│       ├── Base64Utils.java
│       ├── UuidUtils.java
│       └── FunctionTimer.java