Skip to content
Snippets Groups Projects
Commit 2b2690c0 authored by Loïc Ortola's avatar Loïc Ortola
Browse files

fix: improved step 2.3

parent 183b84f2
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,5 @@ import io.temporal.activity.ActivityMethod;
@ActivityInterface
public interface BakeService {
@ActivityMethod
BakeResult bake(BakeRequest request);
void bake();
}
......@@ -8,15 +8,8 @@ import java.util.ArrayList;
public class BakeServiceImpl implements BakeService {
@Override
public BakeResult bake(BakeRequest request) {
System.out.println("Will bake those cookies " + request.bakingPreference());
var cookies = new ArrayList<Cookie>();
for (int i = 0; i < request.batter().targetCookieCount(); i++) {
// Making cookies out of batter
var cookie = new Cookie(request.bakingPreference(), request.batter().topping());
// Add it to the cookies after it is baked
cookies.add(cookie);
}
return new BakeResult(cookies);
public void bake() {
System.out.println("Will bake those cookies");
}
}
package io.takima.temporalpractice.bakery.kitchen.bake.dtos;
import io.takima.temporalpractice.bakery.kitchen.batter.dtos.Batter;
import io.takima.temporalpractice.bakery.kitchen.dtos.KitchenDtos.BakingPreference;
public record BakeRequest(
String orderId,
Batter batter,
BakingPreference bakingPreference
) {
}
package io.takima.temporalpractice.bakery.kitchen.bake.dtos;
import java.util.List;
import static io.takima.temporalpractice.bakery.kitchen.dtos.KitchenDtos.*;
public record BakeResult(List<Cookie> cookies) {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment