Skip to content

Templates Structure

The Templates directory is the engine room of the Talisman Platform's code generation capabilities. It contains the reusable blueprints used by the AsyncAPI Designer, OpenAPI Generator, and UI Wizards to create Apache Camel routes and configuration beans.

Talisman uses a Context-Based Naming Convention to organize these files. This ensures that templates are grouped by the platform feature that consumes them (e.g., AsyncAPI vs. OpenAPI vs. Wizards).

Directory Hierarchy

The templates folder is organized flatly but sorted logically by file prefix:

templates/
├── application.properties               # Project configuration scaffold
├── docker-compose.yaml                  # Docker Compose scaffold
├── docker-stack.yaml                    # Docker Swarm scaffold
├── org.apache.camel.*.java              # Java code templates
├── asyncapi-artemis-beans.camel.yaml    # AsyncAPI: Server Configuration
├── asyncapi-artemis-receive.camel.yaml  # AsyncAPI: Global Consumer Logic
├── asyncapi-artemis-send.camel.yaml     # AsyncAPI: Global Producer Logic
├── asyncapi-kafka-beans.camel.yaml      # AsyncAPI: Alternative Server Config
├── asyncapi-sendOrderSpecial-send.yaml  # AsyncAPI: Custom Operation Override
├── openapi-route.camel.yaml             # OpenAPI: REST DSL Route Generator
├── wizard-bean-aggregation.camel.yaml   # UI: Aggregation Wizard
├── wizard-bean-database.camel.yaml      # UI: Database Wizard
├── wizard-bean-datasource.camel.yaml    # UI: Datasource Wizard
├── wizard-bean-messaging.camel.yaml     # UI: Messaging Wizard
└── wizard-bean-txmanager.camel.yaml     # UI: Transaction Wizard

Template Categories

1. Project Scaffolding

These files are used when a new project is initialized. They establish the runtime environment and build structure.

  • Files: application.properties, docker-compose.yaml, docker-stack.yaml.
  • Usage: Copied to the root of new projects to ensure consistent deployment configurations.

2. AsyncAPI Templates (asyncapi-*)

These templates drive the Event-Driven code generation. They define how the platform connects to brokers and how it sends/receives messages.

  • Naming Convention: asyncapi-[context]-[type].camel.yaml
  • Server Templates: Defined generically for a specific technology (e.g., Artemis, Kafka).
  • asyncapi-artemis-beans: Defines ConnectionFactory beans.
  • asyncapi-artemis-send: The standard route logic for publishing messages.
  • asyncapi-artemis-receive: The standard route logic for subscribing to messages.

  • Operation Overrides: You can create specific templates for individual operations if they require custom logic.

  • asyncapi-[operationId]-send: Talisman checks for this file first. If found, it uses this template instead of the generic server template.

3. OpenAPI Templates (openapi-*)

These templates are used when generating routes from an OpenAPI Definition.

  • Naming Convention: openapi-[type].camel.yaml
  • Usage:
  • openapi-route.camel.yaml: Defines the standard structure for a route implementing operation logic.

4. UI Wizard Templates (wizard-bean-*)

When a user adds a bean using Bean Wizard, Talisman populates the wizard fields based on these templates.

  • Naming Convention: wizard-bean-[component].camel.yaml
  • Examples:
  • wizard-bean-database: Scaffolds a generic SQL DataSource bean.
  • wizard-bean-txmanager: Scaffolds a Spring Transaction Manager bean.

Template Syntax

All templates are written in Camel YAML DSL and use Mustache-style placeholders. During generation, Talisman replaces these placeholders with actual values from your project configuration or architecture definition.

Common Placeholders:

  • {{channel.address}}: The queue or topic name (from AsyncAPI).
  • {{serverId}}: The name of the server (e.g., "artemis").
  • {{operationId}}: The specific operation name (e.g., "onOrderReceived").