public Message buildMessage(
            String locale,
            PushNotificationType type,
            @Nullable String title,
            @Nullable String body,
            Supplier<Object> dataModelSupplier) {
        Map<PushNotificationType, TemplateGroup> typeToTemplate =
                localeToTypeToTemplate.get(locale);
        if (typeToTemplate == null) {
            return new Message(title, body);
        }
        TemplateGroup group = typeToTemplate.get(type);
        if (group == null) {
            return new Message(title, body);
        }
        Object dataModel = null;
        StringBuilderWriter writer = null;
        Template template = group.titleTemplate;
        String titleOutput;
        if (template == null) {
            titleOutput = title;
        } else {
            dataModel = dataModelSupplier.get();
            writer = StringBuilderPool.getWriter();
            try {
                template.process(dataModel, writer);
            } catch (Exception e) {
                throw new RuntimeException("Failed to generate the title output", e);
            } finally {
                writer.close();
            }
            titleOutput = writer.toString();
        }
        template = group.bodyTemplate;
        String bodyOutput;
        if (template == null) {
            bodyOutput = body;
        } else {
            if (writer == null) {
                dataModel = dataModelSupplier.get();
                writer = StringBuilderPool.getWriter();
            }
            try {
                template.process(dataModel, writer);
            } catch (Exception e) {
                throw new RuntimeException("Failed to generate the body output", e);
            } finally {
                writer.close();
            }
            bodyOutput = writer.toString();
        }
        return new Message(titleOutput, bodyOutput);
    }
@return {@link SendPushNotificationException} if the sender failed to send notifications no
        matter what reason
turms-plugins/turms-plugin-push/src/main/java/im/turms/plugin/push/core/PushNotificationSender.java