Samples and Blueprints
Use these copy-ready artifacts as starting points for production integrations. Each sample follows Buzen route conventions, app packaging rules, and management API deployment patterns.
1. Quick deploy sample
quick-demo.bar
|- buzen.json
|- routes/
|- hello.yaml
{
"name": "quick-demo",
"version": "1.0.0",
"routes": [
{ "file": "routes/hello.yaml", "autoStart": true }
]
}
- route:
id: hello-route
from:
uri: "timer:hello?period=5000"
steps:
- log:
message: "Hello from Buzen ESB"
2. Pattern library
HTTP to JMS handoff
- route:
id: api-orders-ingress
from:
uri: "platform-http:/orders?httpMethodRestrict=POST"
steps:
- unmarshal:
json: {}
- setHeader:
name: eventType
constant: "ORDER_CREATED"
- to:
uri: "jms:queue:orders.in"
JMS to database persistence
- route:
id: orders-persist
from:
uri: "jms:queue:orders.in"
steps:
- to:
uri: "buzen-db:execute?dataSourceRef=orders-db&query=insert+into+orders(id,status)+values(:#id,:#status)"
File polling and remote upload (SFTP)
- route:
id: files-to-sftp
from:
uri: "file:/opt/buzen-esb/inbox?include=.*\\.csv&noop=true"
steps:
- to:
uri: "sftp://partner@partner-host/outbound?password={{partner.sftp.password}}"
Policy-protected API route
- route:
id: secure-orders-api
from:
uri: "platform-http:/partners/orders?httpMethodRestrict=POST"
steps:
- validate:
simple: "${body} != null"
- to:
uri: "bean:orderService?method=handle"
Error channel (dead letter)
- route:
id: outbound-with-dlq
errorHandler:
deadLetterChannel:
deadLetterUri: "jms:queue:dead.letter"
maximumRedeliveries: 5
redeliveryDelay: 2000
from:
uri: "direct:sendPartner"
steps:
- to:
uri: "https://partner.example.com/api/push"
3. Production app blueprint
customer-sync.bar
|- buzen.json
|- routes/
| |- ingest.yaml
| |- enrich.yaml
| |- publish.yaml
|- config/
| |- application.yml
|- lib/
|- custom-mapper.jar
{
"name": "customer-sync",
"version": "2.3.1",
"description": "Customer sync integration",
"routes": [
{ "file": "routes/ingest.yaml", "autoStart": true },
{ "file": "routes/enrich.yaml", "autoStart": true },
{ "file": "routes/publish.yaml", "autoStart": true }
],
"config": {
"file": "config/application.yml"
},
"libraries": [
"lib/custom-mapper.jar"
],
"properties": {
"partner.base-url": "https://partner.example.com"
}
}
4. API payload samples
App route upsert request
{
"routeId": "orders-api",
"file": "routes/orders-api.yaml",
"content": "- route:\n id: orders-api\n from:\n uri: \"platform-http:/partners/orders?httpMethodRestrict=POST\"\n steps:\n - to:\n uri: \"jms:queue:orders.in\"",
"autoStart": true
}
Route duplicate request with auto rename
{
"targetAppId": "customer-sync",
"targetRouteId": "orders-api-copy",
"targetFile": "routes/orders-api-copy.yaml",
"targetAutoStart": false,
"copyPolicies": true,
"copyAlerts": true,
"ingressConflictResolution": {
"strategy": "AUTO_RENAME",
"autoRenameSuffix": "-copy"
}
}
5. CI/CD deployment script sample
#!/usr/bin/env bash
set -euo pipefail
BASE_URL="https://<esb-host>:8443/api/v1"
USER="admin"
PASS="admin"
ARCHIVE="customer-sync.bar"
TOKEN=$(curl -ksS -X POST "${BASE_URL}/auth/login" \
-H 'Content-Type: application/json' \
-d "{\"username\":\"${USER}\",\"password\":\"${PASS}\"}" | jq -r '.data.accessToken')
curl -ksS -X POST "${BASE_URL}/apps" \
-H "Authorization: Bearer ${TOKEN}" \
-F "file=@${ARCHIVE}" | jq .
curl -ksS "${BASE_URL}/apps" -H "Authorization: Bearer ${TOKEN}" | jq .
curl -ksS "${BASE_URL}/routes" -H "Authorization: Bearer ${TOKEN}" | jq .
Validate payloads with schema files in reference/docs/schemas before deploy.