TriggerMesh supported brokers.
Configuration informs about the Triggers that send events to targets. Durations follow ISO 8601 format
triggers:
trigger1:
filters:
- exact:
type: example.type
target:
url: http://localhost:8888
deliveryOptions:
retry: 2
backoffDelay: PT2S
backoffPolicy: linear
trigger2:
target:
url: http://localhost:9999
deliveryOptions:
retry: 5
backoffDelay: PT5S
backoffPolicy: constant
deadLetterURL: http://localhost:9000Produce CloudEvents by sending then using an HTTP client.
curl -v http://localhost:8080/ \
-H "Ce-Specversion: 1.0" \
-H "Ce-Type: example.type" \
-H "Ce-Source: example.source" \
-H "Ce-Id: 1234-abcd-x" \
-H "Content-Type: application/json" \
-d '{"hello":"broker"}'Redis Broker needs a Redis backing server to perform pub/sub operations and storage.
The broker uses a single Redis stream named triggermesh by default, that can be customized using redis.stream argument.
The Redis user must be configured to use the stream group of commands on the stream key, plus using the client command with id subcomand for probes.
When using a single Redis backend, it is important to use a unique stream per broker to isolate messages.
# In this example the broker will be configured with user triggermesh1
# and stream name triggermeshstream
ACL SETUSER triggermesh1 on >7r!663R +@stream +client|id ~triggermeshstream# Create storage folder
mkdir -p .local/data
# Run Redis alternative
docker run -d -v $PWD/.local/data:/data \
-e REDIS_ARGS="--appendonly yes --appendfsync always --rdbcompression yes" \
--name redis-stack-server \
-p 6379:6379 \
redis/redis-stack-server:latestLaunch the broker providing parameters for the backing server.
go run ./cmd/redis-broker start \
--redis.address "0.0.0.0:6379" \
--broker-config-path ".local/broker-config.yaml"When using an authenticated Redis instance, user and password can be informed via redis.username and redis.password arguments.
go run ./cmd/redis-broker start \
--redis.username triggermesh1 \
--redis.password "7r\!663R" \
--redis.address "some.redis.server:25101" \
--broker-config-path .local/broker-config.yamlIf the Redis instance is exposed using TLS, it must enabled at the broker config via redis.tls-enabled flag. For self-signed certificates you can inform them with redis.tls-ca-certificate or skip verification (not recommended) with redis.tls-skip-verify.
go run ./cmd/redis-broker start \
--redis.username triggermesh1 \
--redis.password "7r\!663R" \
--redis.tls-enabled \
--redis.tls-ca-certificate="-----BEGIN CERTIFICATE-----abc123-----END CERTIFICATE-----" \
--redis.address "tls.self.signed.redis.server:25102" \
--broker-config-path .local/broker-config.yamlWhen configuring TLS certificates for Redis authentication, make use of redis.tls-certificate and redis.tls-key.
go run ./cmd/redis-broker start \
--redis.tls-enabled \
--redis.tls-certificate='-----BEGIN CERTIFICATE-----
deadbeef..
-----END CERTIFICATE-----' \
--redis.tls-key='-----BEGIN PRIVATE KEY-----
c0ff33...
-----END PRIVATE KEY-----' \
--redis.address "tls.redis.server:25102" \
--broker-config-path .local/broker-config.yamlParameters for the broker can be set as environment variables.
BROKER_CONFIG_PATH=.local/broker-config.yaml \
REDIS_ADDRESS=tls.self.signed.redis.server:25102 \
REDIS_USERNAME=triggermesh1 \
REDIS_PASSWORD=7r\!663R \
REDIS_TLS_ENABLED=true \
REDIS_TLS_SKIP_VERIFY=true \
go run ./cmd/redis-broker startNote: when using a Redis cluster provide a comma separated list of nodes at REDIS_CLUSTER_ADDRESSES instead of the REDIS_ADDRESS parameter.
go run ./cmd/memory-broker start --memory.buffer-size 100 --memory.produce-timeout 1s --broker-config-path ".local/config.yaml"Alternatively environment variables could be used.
CONFIG_PATH=.local/config.yaml MEMORY_BUFFER_SIZE=100 MEMORY_PRODUCE_TIMEOUT=1s go run ./cmd/memory-broker startdocker build -t my-repo/redis-broker:my-version .
docker push my-repo/redis-broker:my-version
docker build -t my-repo/memory-broker:my-version .
docker push my-repo/memory-broker:my-versionThe observability-config-path flag allows you to customize observability settings.
go run ./cmd/redis-broker start --redis.address "0.0.0.0:6379" \
--broker-config-path .local/broker-config.yaml \
--observability-config-path .local/observability-config.yamlThe file contains a zap-logger-config element where a zap configuration should be located. Updating the file will update the logging level.
zap-logger-config: |
{
"level": "info",
"development": false,
"outputPaths": ["stdout"],
"errorOutputPaths": ["stderr"],
"encoding": "json",
"encoderConfig": {
"timeKey": "timestamp",
"levelKey": "severity",
"nameKey": "logger",
"callerKey": "caller",
"messageKey": "message",
"stacktraceKey": "stacktrace",
"lineEnding": "",
"levelEncoder": "",
"timeEncoder": "iso8601",
"durationEncoder": "",
"callerEncoder": ""
}
}Prefixes redis. and memory. apply only to their respective broker binaries.
Install addlicense:
go install github.com/google/addlicense@v1.0.0Make sure all files contain a license
addlicense -c "TriggerMesh Inc." -y $(date +"%Y") -l apache -s=only ./**/*.go