Tell me, please, what's different in declare two methods
service MyService {
void test1();
oneway void test2();
}
Manual says
The oneway modifier indicates that the client only makes a request and does not wait for any response at all. Oneway methods MUST be void.
But any void method says that the client does not expect any results. Then why oneway
?
Or the difference is that the normal method is executed synchronously and the client returns only after the method has been tested on the server, and oneway was pulled and forgotten? And as a consequence, from oneway can not come an exception
Your last assumption is accurate!
Quoting The Programmer's Guide to Apache Thrift:
"Oneway functions are distinct from normal functions in that calling normal functions, such as “void myFunc( 1: i16 val );” always results in a response message from the server. This may seem strange in the context of a void function, however, while void functions do not return anything at the application level, the Processor does send an RPC response back to the Client proxy. When this response arrives the Client proxy returns from the call made by the user code in synchronous interfaces. One reason for this synchronization is that any normal function may throw an exception, even a void function. The user code must wait for the server response to know that the function, even a void function, completed successfully.
Because oneway functions do not receive a response of any type, it is impossible for a oneway function caller to know when or if the call completed. In cases where a client needs to notify a server, without regard to the result, oneway is a good option. Onway functions can have parameters like any other function but should be declared void (the IDL Compiler warns about non-void oneway return types and never returns anything to the client of a oneway call)."