Overrding the Instruction implementation
- huwOP 2
Hi there, I am seeking to override the implementation of
Instruction, but I want to re-use the logic provided by the default implementation ofBatch. The problem is that the defaultBatchexercises by key on the defaultInstructions - so if I try to re-use this logic it won’t work on my custom implementation ofInstruction. Having to do a copy-paste of the defaultBatchimplementation is not a nice solution. - Johan_Sjodin
Hi @huw,
thanks for pointing this out. The Instruction and Batch implementations are indeed tightly coupled.
A way to decouple them would be to use interface contact keys, similiar to how Account and Instrument interfaces are keyed. Note that we currently don‘t have support for interface keys in the language, we rather have a workaround in place for achieving this (using an associated keyed Reference template instance which refers to the corresponding interface instance by contract id). We have been a bit reluctant to use this workaround frequently though. That being said, there are also alternative ways to decouple them (using contract ids).
We have planned to revisit this topic in the new year. Until then Im afraid you would need to create your own Batch implementation.
Best Regards,
Johan