linkedin / parseq

Asynchronous Java made easier
Apache License 2.0
1.17k stars 266 forks source link

Getting the output of side effect #270

Closed Anmol-Singh-Jaggi closed 4 years ago

Anmol-Singh-Jaggi commented 4 years ago

Is it ever possible (or useful) to get the output of a side effect task? If not, then shouldn't the second argument here be Task<Void> rather than Task<?>?

junchuanwang commented 4 years ago

I understand why could have this kind of question. Your understanding is correct though, the withSideEffect tasks generally do not require output.

But in Parseq we kept this open because it does have other use case. For example you can refer to an existing Task and run it with withSideEffect.

So to conclude, we keep this open. For withSideEffect whether it returns or not doesn't matter that much. What mattered is its task lifecycle, think it as a daemon

Anmol-Singh-Jaggi commented 4 years ago

Got it. Thanks