File tree Expand file tree Collapse file tree 2 files changed +62
-12
lines changed
java/io/durabletask/samples Expand file tree Collapse file tree 2 files changed +62
-12
lines changed Original file line number Diff line number Diff line change @@ -190,18 +190,8 @@ public String createOrder(@RequestBody String orderJson) throws Exception {
190190 orderJson
191191 );
192192
193- // Wait for the orchestration to complete with a timeout
194- OrchestrationMetadata metadata = client .waitForInstanceCompletion (
195- instanceId ,
196- Duration .ofSeconds (30 ),
197- true
198- );
199-
200- if (metadata .getRuntimeStatus () == OrchestrationRuntimeStatus .COMPLETED ) {
201- return metadata .readOutputAs (String .class );
202- } else {
203- return "{\" status\" : \" " + metadata .getRuntimeStatus () + "\" }" ;
204- }
193+ // Return the instance ID immediately without waiting for completion
194+ return "{\" instanceId\" : \" " + instanceId + "\" }" ;
205195 }
206196
207197 @ GetMapping ("/{instanceId}" )
Original file line number Diff line number Diff line change 1+ ### Variables
2+ @instanceId = dafc6c87-964b-4e99-8aaf-a5d1061de890
3+
4+ ### Create a new order
5+ POST http://localhost:8082/api/orders
6+ Content-Type: application/json
7+
8+ {
9+ "orderId" : " ORD123456" ,
10+ "customerId" : " CUST789" ,
11+ "amount" : 125.50 ,
12+ "items" : [
13+ {
14+ "productId" : " PROD001" ,
15+ "quantity" : 2 ,
16+ "price" : 49.99
17+ },
18+ {
19+ "productId" : " PROD002" ,
20+ "quantity" : 1 ,
21+ "price" : 25.52
22+ }
23+ ],
24+ "shippingAddress" : {
25+ "street" : " 123 Main St" ,
26+ "city" : " Seattle" ,
27+ "state" : " WA" ,
28+ "zipCode" : " 98101" ,
29+ "country" : " USA"
30+ }
31+ }
32+
33+ ### Get order by instance ID
34+ # Replace the instanceId variable with the actual value returned from the create order request
35+ GET http://localhost:8082/api/orders/{{instanceId}}
36+ Content-Type: application/json
37+
38+ ### Example with invalid order (amount is 0)
39+ POST http://localhost:8082/api/orders
40+ Content-Type: application/json
41+
42+ {
43+ "orderId" : " ORD123457" ,
44+ "customerId" : " CUST789" ,
45+ "amount" : 0 ,
46+ "items" : [
47+ {
48+ "productId" : " PROD003" ,
49+ "quantity" : 1 ,
50+ "price" : 0
51+ }
52+ ],
53+ "shippingAddress" : {
54+ "street" : " 123 Main St" ,
55+ "city" : " Seattle" ,
56+ "state" : " WA" ,
57+ "zipCode" : " 98101" ,
58+ "country" : " USA"
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments