Singles Path Service - Domain-Driven Design
Overview
The Singles Path Service manages direct pick-to-pack workflows for single-item orders. It handles approximately 40-50% of all warehouse orders through the most streamlined fulfillment path.
| Attribute |
Value |
| Port |
8083 |
| Package |
com.paklog.wms.processpath.singles |
| Database |
MongoDB |
| Messaging |
Apache Kafka |
Domain Model
Aggregates
SinglesSession (Root Aggregate)
Represents a single-item order session through direct pick-to-pack workflow.
1
2
3
4
5
6
7
8
9
10
11
12
13
| public class SinglesSession {
private String sessionId;
private String orderId;
private String shipmentId;
private String workerId;
private String stationId;
private SessionStatus status;
private String itemSku;
private String assignedPickLocation;
private String assignedPackStation;
private LocalDateTime startedAt;
private LocalDateTime completedAt;
}
|
State Machine:
stateDiagram-v2
[*] --> INITIATED
INITIATED --> PICKING: assignWorker()
PICKING --> PACKING: completePick()
PACKING --> COMPLETED: completePack()
INITIATED --> FAILED: fail()
PICKING --> FAILED: fail()
PACKING --> FAILED: fail()
Business Rules:
- Session starts in INITIATED status
- Worker assignment transitions to PICKING
- Pick completion transitions to PACKING
- Pack completion marks session as COMPLETED
Value Objects
PickLocation
1
2
3
4
5
6
7
| public record PickLocation(
String locationId,
String aisle,
String bay,
String level,
String position
) {}
|
PackStation
1
2
3
4
5
| public record PackStation(
String stationId,
String zone,
boolean isExpress
) {}
|
Domain Events
Events Published
| Event |
Type |
Description |
| SinglesSessionStartedEvent |
com.paklog.processpath.singles.session-started.v1 |
Singles session initiated |
| SinglesPickCompletedEvent |
com.paklog.processpath.singles.pick-completed.v1 |
Item picked for singles order |
| SinglesPackCompletedEvent |
com.paklog.processpath.singles.pack-completed.v1 |
Singles order packed |
Events Consumed
| Source |
Topic |
Event |
Handler |
| Process Path Routing |
process-path.routing.v1.events |
ShipmentRoutedToPathEvent |
PathAssignedEventConsumer |
| Pack & Ship |
wes.pack.v1.events |
PackingCompletedEvent |
PackingCompletedHandler |
Domain Services
SinglesSessionService
1
2
3
4
5
6
7
8
| public interface SinglesSessionService {
SinglesSession createSession(String orderId, String shipmentId, String itemSku);
SinglesSession assignWorker(String sessionId, String workerId, String stationId);
SinglesSession completePick(String sessionId, String pickLocation);
SinglesSession completePack(String sessionId, String packStation);
SinglesSession getSession(String sessionId);
List<SinglesSession> getSessionsByStatus(SessionStatus status);
}
|
API Endpoints
Singles Sessions
| Method |
Endpoint |
Description |
| POST |
/api/v1/singles-sessions |
Create session |
| PUT |
/api/v1/singles-sessions/{id}/assign |
Assign worker |
| PUT |
/api/v1/singles-sessions/{id}/pick |
Complete pick |
| PUT |
/api/v1/singles-sessions/{id}/pack |
Complete pack |
| GET |
/api/v1/singles-sessions/{id} |
Get session details |
Workflow
sequenceDiagram
participant ROUTING as Routing Service
participant SINGLES as Singles Service
participant PICKER as Picker
participant PACKER as Packer
participant SLAM as SLAM Service
ROUTING->>SINGLES: ShipmentRoutedToPathEvent
SINGLES->>SINGLES: Create session
SINGLES-->>SINGLES: SinglesSessionStartedEvent
SINGLES->>PICKER: Assign pick task
PICKER->>PICKER: Pick item
PICKER->>SINGLES: Complete pick
SINGLES-->>SINGLES: SinglesPickCompletedEvent
SINGLES->>PACKER: Direct to pack station
PACKER->>PACKER: Pack item
PACKER->>SINGLES: Complete pack
SINGLES-->>SLAM: SinglesPackCompletedEvent
Repository Interfaces
1
2
3
4
5
6
| public interface SinglesSessionRepository {
SinglesSession save(SinglesSession session);
Optional<SinglesSession> findById(String sessionId);
List<SinglesSession> findByStatus(SessionStatus status);
List<SinglesSession> findByWorkerId(String workerId);
}
|
Integration Patterns
Customer-Supplier
- Upstream: Process Path Routing Service supplies path assignments
- Downstream: SLAM Operations Service consumes pack completion events
- Pack & Ship: Consumes packing completion events for workflow tracking
Characteristics
| Characteristic |
Value |
| Typical Volume |
40-50% of orders |
| Order Type |
Single-item orders |
| Workflow |
Direct pick-to-pack |
| Cycle Time |
Fastest path (~5-10 min) |
| Labor Model |
One worker per order |
Technology Stack
| Component |
Technology |
| Language |
Java 21 |
| Framework |
Spring Boot 3.3.3 |
| Database |
MongoDB 7.0 |
| Messaging |
Apache Kafka 7.5.0 |
| Event Format |
CloudEvents 2.5.0 |
References