I have a custom block that reads some of its configuration from tenant options. So far, I have implemented this in the $init action:
action $init() {
monitor.subscribe(FindTenantOptionsResponse.SUBSCRIBE_CHANNEL);
FindTenantOptions tenantOptionRequest := new FindTenantOptions;
tenantOptionRequest.reqId := Util.generateReqId();
tenantOptionRequest.category := "...";
on FindTenantOptionsResponse(reqId = tenantOptionRequest.reqId) as tor {
monitor.unsubscribe(FindTenantOptionsResponse.SUBSCRIBE_CHANNEL);
}
send tenantOptionRequest to FindTenantOptions.SEND_CHANNEL;
}
But I would like to properly handle cases where these tenant options are not set. I could move the logic to $validate but the problem is that because I receive the tenant options in a listener, the $validate action will already have terminated successfully.