I'm following along the documentation about the Tokens SDK: https://github.com/corda/token-sdk/blob/master/docs/IWantTo.md#issuing-tokens
My question is fairy simple: what's the difference between using
IssueTokens(fungibleToken)
and
subFlow(IssueTokensFlow(fungibleToken, listOf(holderSession)))?
What implications does one have on the other? When should I use one or the other? I've read the documentation about flowss/subflows, but it's not clear what the difference is: https://docs.r3.com/en/platform/corda/4.9/community/api-flows.html#subflows
I suggest to always go read the source code in case of questions like this. Comments and unit tests are your best friends. Corda source code is very well documented, so you will always find what you are looking for.
From the source code of each function you mentioned:
So, the main difference is that IssueTokens does already some things for you and can run by itself, while IssueTokensFlow needs to be included in a flow that you write and needs inputs that you need to implement before calling it.