Sends the given
command
and wait for it to execute. The result of the execution is returned when available. This method will block indefinitely, until a result is available, or until the Thread is interrupted. When the thread is interrupted, this method returnsnull
. If command execution resulted in an exception, it is wrapped in aorg.axonframework.commandhandling.CommandExecutionException
..
So is the caller thread blocked or the thread spawned after the sendAndWait is fired is blocked.For example if i am calling the sendAndWait() command from main will main thread be blocked ? And if it is the case then
class main (String args[])
{
commandGateway.sendAndWait(new Command());
System.out.println("Thread not blocked");
}
"Thread not blocked" should not be logged.
Second:
The sendAndWait() command returns the result for the execution of the command.
From the docs:
The result of the execution is returned when available.
and in the commandHandler we write :
@CommandHandler
public void acknowledge(AcknowledgedCommand acknowledgedCommand) {
apply(new AcknowledgedEvent(
acknowledgedCommand.getA(), acknowledgedCommand.getB()));
}
The apply command return's void then how the command execution result is returned.Even if do some modification in the eventHandler like returning value from the event handler (which is not recommended but done only for the purpose of testing)
@SagaEventHandler(associationProperty = "a")
public String handle(StateEvent stateEvent) {
return this.state = stateEvent.getState();
}
The event would not return back anything on the commandHandler. As the flow does not go back again to the commandHandler after execution of the event (until and unless command is published from the event ). Then what is actually returned from the execution ?
If anyone can clarify it would be great.
Thanks,
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.