You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to pause the task sequence, check condition and cancel out the sequence.
Task<OrderDatagram> t1 = Task.value(orderData);
Task<OrderDatagram> t2 = t1.andThen( d -> d.setCurrency(Optional.of("dollars")));
Task<OrderDatagram> t3 = t2.andThen( d -> {
if(d.getCurrency().equals("dollars")){
System.out.println("The verification is not passed throw error");
//// This is the part doesnt work as what I think it is. Is there a way to stop the process fro the rest of the task and not trigger the onFailure in temp ??
t2.cancel(new OrderDatagramValidationException.Item.ExistsException(1,"abc",1));
}
});
Task<OrderDatagram> temp = t3.andThen( t -> {
throw new Exception();
}).onFailure( t->{
throw new Exception();
});
The text was updated successfully, but these errors were encountered:
Task<OrderDatagram> t1 = Task.value(orderData)
.map(d -> {
if (d.getCurrency().equals("dollars")){
throw new OrderDatagramValidationException.Item.ExistsException(1,"abc",1);
}
return d;
});
Though note that this is not a good Parseq use case since there is no blocking execution involved (unless this was just a simple example you posted which isn't similar to the actual problem you're trying to solve)
Is there a way to pause the task sequence, check condition and cancel out the sequence.
The text was updated successfully, but these errors were encountered: