Code standards
Follow Grand Central coding standards and best practices
Configure connector
Configure your custom connector for deployment
Test and validate
Write and run tests to verify your connector
Technology stack
Custom connectors are built using:- Apache Camel-K: Integration framework for Kubernetes
- Maven: Build and dependency management
- Java: Primary development language
- GitHub Actions: Continuous integration and deployment
Development workflow
Follow this workflow to develop your connector locally and prepare it for deployment.Local development setup
Prerequisites
Install the following tools on your local machine:- Java JDK 11+: Required for building
- Download OpenJDK 11
- Oracle JDK 11
- Verify installation:
java -version
- Maven 3.6+: Build tool
- Download Maven
- Maven Installation Guide
- Verify installation:
mvn -version
- Git: Version control
- Download Git
- Git Installation Guide
- Verify installation:
git --version
- Docker (optional): For local testing with Camel-K
- kubectl (optional): For Kubernetes access
Clone your repository
Understand the project structure
Your connector template includes:pom.xml: Maven project configuration and dependenciesapplication.properties: Configuration properties for your connectorroutes/: Camel route definitions (XML or Java DSL)MyConnectorApplication.java: Main application class
Build your connector
Use Maven to compile, test, and package your connector.Build locally
Build output
The build process creates:- JAR file:
target/my-custom-connector-<version>.jar - Test reports:
target/surefire-reports/ - Docker image (if configured): For Camel-K deployment
Develop integration routes
Define your integration logic using Apache Camel routes.Camel route basics
Connectors use Apache Camel routes to define integration flows. Routes can be defined in: XML DSL (recommended for complex routes):Common integration patterns
REST API integration:Configure your connector
Configure your connector using properties files and environment variables.Application properties
Configure your connector insrc/main/resources/application.properties:
Environment variables
Use environment variables for sensitive data:- Manage secrets through the self-service repository
- Access via
${VARIABLE_NAME}in properties files - Set in Kubernetes deployment configurations
Test your connector
Write and run tests to verify your connector works correctly.Unit tests
Write unit tests for your routes and components:Integration tests
Test against real or mocked external services:Run tests
Validate code quality
Ensure your code meets quality standards before committing.Automated checks
The CI/CD pipeline automatically runs:- Maven Build Validation: Ensures project compiles
- SonarCloud Analysis: Code quality and security scanning
- Test Execution: All unit and integration tests
Pre-commit checklist
Before committing your code:- Code compiles without errors
- All tests pass locally
- No hardcoded credentials or secrets
- Configuration uses environment variables
- Code follows project conventions
- Documentation is updated
Manage version control
Use Git for version control and follow the branching strategy.Branch strategy
develop: Main development branchmain: Production-ready code- Feature branches:
feature/my-feature - Release branches:
release/v1.0.0
Commit best practices
Follow conventional commits with Jira scope:Pull request process
- Create a feature branch from
develop - Make your changes and commit
- Push to GitHub and create a Pull Request
- Wait for CI checks to pass
- Get code review approval
- Merge to develop when approved
Manage dependencies
Manage your project’s dependencies in the Mavenpom.xml file.
Add dependencies
Editpom.xml to add dependencies:
Common dependencies
- Camel components: HTTP, REST, JMS, Kafka, and others
- JSON Processing: Jackson, Gson
- Logging: SLF4J, Logback
- Testing: JUnit, Mockito, Camel Test
Find dependencies
- Maven Central Repository - Search for dependencies
- Apache Camel Components - Available Camel components
Build for production
Prepare your connector for production deployment.Release process
- Update version in
pom.xml - Create release branch from
develop - Run full test suite
Merge to mainafter approval- Tag the release in GitHub
Build artifacts
The build process creates:- JAR artifact: For deployment
- Docker image (if configured): For containerized deployment
- Documentation: Generated API docs
CI/CD pipeline
Your connector repository includes GitHub Actions workflows that automatically:- Validate Pull Requests: Run Maven build and tests
- Code Quality: SonarCloud analysis
- Security Scanning: Dependency vulnerability checks
- Build Artifacts: Create JAR files and Docker images
- View pipeline runs in your repository’s Actions tab
- Check individual workflow files in
.github/workflows/ - GitHub Actions Documentation
Validate pull request / Verify Maven project- Ensures code compilesSonarCloud Code Analysis- Code quality and security checks
Quick reference: common commands
Use these commands for common development tasks.Git commands
Maven commands
Kubernetes commands
If you have access to the Kubernetes cluster, you can use these commands:Troubleshooting
Resolve common issues that occur during development.Build failures
Issue: Maven build fails- Solution: Check Java version compatibility
- Solution: Verify all dependencies are available
- Solution: Clean and rebuild:
mvn clean install - Resources: Maven Troubleshooting Guide
- Solution: Ensure environment variables are set
- Solution: Check for local configuration differences
- Solution: Review test output in
target/surefire-reports/
Dependency issues
Issue: Missing dependencies- Solution: Check Maven repository access
- Solution: Verify dependency versions in
pom.xml - Solution: Check Maven Central for correct coordinates
- Solution: Use
mvn dependency:treeto identify conflicts - Solution: Use
mvn versions:display-dependency-updatesto check for updates
Common issues
Issue: Camel route not working- Solution: Check Apache Camel Error Handling
- Solution: Verify route configuration and component availability
- Solution: Enable debug logging to trace route execution
- Solution: Verify roles in
self-service.tfvars - Solution: Contact team lead for access requests
- Solution: Check GitHub team membership
Best practices
- Keep routes simple: Break complex flows into smaller routes
- Use configuration: Avoid hardcoding values
- Handle errors: Implement proper error handling and retries
- Log appropriately: Use appropriate log levels
- Test thoroughly: Write unit and integration tests
- Document changes: Update README and inline documentation
- Follow naming conventions: Use consistent naming for routes and components
- Review dependencies: Regularly update dependencies for security patches