mirror of
https://github.com/OtusTeam/Spring.git
synced 2026-06-20 11:14:34 +00:00
Актуализация примеров на занятие 26 (SI: Endpoints и Flow Components) для группы 2019-08
This commit is contained in:
@@ -60,25 +60,14 @@ public class App {
|
||||
while ( true ) {
|
||||
Thread.sleep( 1000 );
|
||||
|
||||
Collection<OrderItem> items = generateOrderItems();
|
||||
OrderItem items = generateOrderItem();
|
||||
System.out.println( "New orderItems: " +
|
||||
items.stream().map( OrderItem::getItemName )
|
||||
.collect( Collectors.joining( "," ) ) );
|
||||
Collection<Food> food = cafe.process( items );
|
||||
System.out.println( "Ready food: " + food.stream()
|
||||
.map( Food::getName )
|
||||
.collect( Collectors.joining( "," ) ) );
|
||||
items.getItemName() );
|
||||
Food food = cafe.process( items );
|
||||
System.out.println( "Ready food: " + food.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
private static Collection<OrderItem> generateOrderItems() {
|
||||
List<OrderItem> items = new ArrayList<>();
|
||||
for ( int i = 0; i < RandomUtils.nextInt( 1, 5 ); ++ i ) {
|
||||
items.add( generateOrderItem() );
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private static OrderItem generateOrderItem() {
|
||||
return new OrderItem( MENU[ RandomUtils.nextInt( 0, MENU.length ) ] );
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ru.otus.spring.integration;
|
||||
|
||||
|
||||
import ru.otus.spring.integration.domain.Food;
|
||||
import ru.otus.spring.integration.domain.OrderItem;
|
||||
|
||||
@@ -10,5 +9,5 @@ import java.util.Collection;
|
||||
public interface Cafe {
|
||||
|
||||
// TODO: add gateway annotation with required channels
|
||||
Collection<Food> process( Collection<OrderItem> orderItem );
|
||||
Food process( OrderItem orderItem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user