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 queueCore Abstractions
| Class | Purpose |
|---|---|
Server | JMS queue listener, manages method registration and message routing |
Request | Incoming message wrapper (auth, tenantID, userID, method, body) |
Response | Outgoing result with HTTP-like status codes |
Method | Interface for handler implementations |
ServerProperties | Configuration 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:
| Field | Description |
|---|---|
auth | Base64-encoded Basic Auth credentials |
timestamp | Request timestamp |
userID | Requesting user UUID |
tenantID | Tenant UUID |
method | Registered method name to invoke |
body | JSON 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) // 500Arguments 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
| Method | Purpose |
|---|---|
isAuthenticated(Request) | Override for custom authentication logic |
handleException(Exception) | Override for custom error handling |
Utility Classes
| Class | Functionality |
|---|---|
BasicAuth | Decode Base64 Basic Auth headers |
StringUtils | Parsing, comma-split, random password generation (Base62) |
Base62 | Base62 encoding for tokens |
Base64Utils | Base64 encoding and random string generation |
UuidUtils | UUID generation, validation, hyphen management |
FunctionTimer | Nanosecond performance profiling |
Utils | Null 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
| Dependency | Version | Purpose |
|---|---|---|
qpid-jms-client | 2.5.0 | AMQP protocol |
paho.mqtt | 1.2.5 | MQTT protocol |
okhttp | 4.12.0 | HTTP client |
commons-codec | 1.15 | Encoding utilities |
commons-daemon | 1.3.4 | Unix daemon support |
slf4j + reload4j | 2.0.11 | Logging |
protobuf-java | 3.22.0 | Serialization |
Json (Luqon) | internal | JSON 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