How interact between PublishSubject and PublishProcessor to simulate deliveries?
I have this problem:
I have a list of Orders
Receive the orders filter by temp hot, cook the order,
Place the order on the hot shelf, after that a courier will deliver the orders every 3 seconds.
If the shelf is full discard the orders in the shelf.
Hot shelf -> Size: 10
I tried use PublishSubject to send to a PublishProcessor that will be the hot shelf
but that does not work?
Any idea about how to achieve that?
I do not have to much experience with reactive programming.
---------------------------------------------------------------------------------------------------------------
Link: https://pastebin.pl/view/4a1d82e3
the output is: Sent to hot Shelf, Size: 1
Sent to hot Shelf, Size: 2
Sent to hot Shelf, Size: 3
Sent to hot Shelf, Size: 4
Sent to hot Shelf, Size: 5
Sent to hot Shelf, Size: 6
Waiting for the courier..
Sent to hot Shelf, Size: 7
Sent to hot Shelf, Size: 8
Sent to hot Shelf, Size: 9
..
It finished when the loop to iterate the list ends and it didn't deliver a single order.