Batch Flow Path Service - Domain-Driven Design
Overview
The Batch Flow Path Service manages batch picking and put-wall consolidation workflows for multi-item orders. It handles approximately 15-20% of all warehouse orders through batch picking with subsequent put-wall sorting.
| Attribute |
Value |
| Port |
8085 |
| Package |
com.paklog.wms.processpath.batch |
| Database |
MongoDB |
| Messaging |
Apache Kafka |
Domain Model
Aggregates
PickBatch (Root Aggregate)
Represents a batch of orders grouped for efficient picking with put-wall consolidation.
1
2
3
4
5
6
7
8
9
10
11
12
13
| public class PickBatch {
private String batchId;
private String warehouseId;
private String waveId;
private List<String> orderIds;
private int totalItems;
private int totalUnits;
private BatchStatus status;
private String assignedPicker;
private LocalDateTime createdAt;
private LocalDateTime pickingStartedAt;
private LocalDateTime pickingCompletedAt;
}
|
State Machine:
stateDiagram-v2
[*] --> CREATED
CREATED --> ASSIGNED: assignPicker()
ASSIGNED --> PICKING: startPicking()
PICKING --> SORTING: completePicking()
SORTING --> COMPLETED: completeConsolidation()
CREATED --> CANCELLED: cancel()
ASSIGNED --> CANCELLED: cancel()
Business Rules:
- Batch must be in CREATED status to assign picker
- Batch must be ASSIGNED to start picking
- Batch must be PICKING to complete picking
- Batch must be SORTING to complete consolidation
PutWall
Represents a physical put-wall with slots for order consolidation.
1
2
3
4
5
6
7
8
| public class PutWall {
private String wallId;
private String warehouseId;
private int totalSlots;
private int availableSlots;
private List<PutSlot> slots;
private WallStatus status;
}
|
Value Objects
PutSlot
1
2
3
4
5
6
7
8
9
10
11
12
13
| public record PutSlot(
int slotNumber,
String orderId,
SlotStatus status,
int expectedItems,
int receivedItems,
LocalDateTime assignedAt,
LocalDateTime completedAt
) {
public boolean isComplete() {
return receivedItems >= expectedItems;
}
}
|
Domain Events
Events Published
| Event |
Type |
Description |
| BatchCreatedEvent |
com.paklog.processpath.batch.batch-created.v1 |
Batch created for picking |
| BatchPickingCompletedEvent |
com.paklog.processpath.batch.picking-completed.v1 |
All items picked for batch |
| PutWallSortCompletedEvent |
com.paklog.processpath.batch.sort-completed.v1 |
Item sorted to put-wall slot |
| OrderConsolidatedEvent |
com.paklog.processpath.batch.order-consolidated.v1 |
Order consolidated in put-wall |
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
PickBatchService
1
2
3
4
5
6
7
8
9
| public interface PickBatchService {
PickBatch createBatch(String warehouseId, String waveId, List<String> orderIds, int totalItems);
PickBatch assignPicker(String batchId, String pickerId);
PickBatch startPicking(String batchId);
PickBatch completePicking(String batchId);
PickBatch completeConsolidation(String batchId);
PickBatch getBatch(String batchId);
List<PickBatch> getBatchesByWave(String waveId);
}
|
PutWallService
1
2
3
4
5
6
7
| public interface PutWallService {
PutSlot assignOrderToSlot(String wallId, int slotNumber, String orderId, int expectedItems);
PutSlot putItemToSlot(String wallId, int slotNumber, String itemId);
PutSlot completeSlot(String wallId, int slotNumber);
void clearSlot(String wallId, int slotNumber);
PutWall getWallStatus(String wallId);
}
|
BatchWorkAssignmentService
1
2
3
4
| public interface BatchWorkAssignmentService {
void handlePathAssignment(ShipmentRoutedToPathEvent event);
void handlePackingCompleted(PackingCompletedEvent event);
}
|
API Endpoints
Pick Batches
| Method |
Endpoint |
Description |
| POST |
/api/v1/pick-batches |
Create batch |
| PUT |
/api/v1/pick-batches/{batchId}/assign-picker |
Assign picker |
| PUT |
/api/v1/pick-batches/{batchId}/start-picking |
Start picking |
| PUT |
/api/v1/pick-batches/{batchId}/complete-picking |
Complete picking |
| PUT |
/api/v1/pick-batches/{batchId}/complete-consolidation |
Complete consolidation |
| GET |
/api/v1/pick-batches/{batchId} |
Get batch details |
| GET |
/api/v1/pick-batches/wave/{waveId} |
Get batches by wave |
Put Walls
| Method |
Endpoint |
Description |
| PUT |
/api/v1/put-walls/{wallId}/slots/{slotNumber}/assign |
Assign order to slot |
| PUT |
/api/v1/put-walls/{wallId}/slots/{slotNumber}/put-item |
Put item to slot |
| PUT |
/api/v1/put-walls/{wallId}/slots/{slotNumber}/complete |
Complete slot |
| PUT |
/api/v1/put-walls/{wallId}/slots/{slotNumber}/clear |
Clear slot |
| GET |
/api/v1/put-walls/{wallId} |
Get put wall status |
Workflow
sequenceDiagram
participant ROUTING as Routing Service
participant BATCH as Batch Flow Service
participant PICKER as Picker
participant WALL as Put Wall
participant SLAM as SLAM Service
ROUTING->>BATCH: ShipmentRoutedToPathEvent
BATCH->>BATCH: Create/Add to batch
BATCH->>PICKER: Assign batch
PICKER->>PICKER: Pick items
BATCH-->>BATCH: BatchPickingCompletedEvent
PICKER->>WALL: Sort items to slots
BATCH-->>BATCH: PutWallSortCompletedEvent
WALL->>WALL: Complete order consolidation
BATCH-->>SLAM: OrderConsolidatedEvent
Repository Interfaces
1
2
3
4
5
6
7
8
9
10
11
12
| public interface PickBatchRepository {
PickBatch save(PickBatch batch);
Optional<PickBatch> findById(String batchId);
List<PickBatch> findByWaveId(String waveId);
List<PickBatch> findByStatus(BatchStatus status);
}
public interface PutWallRepository {
PutWall save(PutWall wall);
Optional<PutWall> findById(String wallId);
List<PutWall> findByWarehouseId(String warehouseId);
}
|
Integration Patterns
Customer-Supplier
- Upstream: Process Path Routing Service supplies path assignments
- Downstream: SLAM Operations Service consumes order consolidation events
- Pack & Ship: Consumes packing completion events for workflow tracking
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