This quickstart will take you through the fastest and easiest way to start using events with TriggerMesh's command line interface,
tmctl makes it easy to create, configure and run TriggerMesh on any machine that has Docker.
By the end of this quickstart you will have done the following:
- captured events an external service by polling it over HTTP. It generates text that will be used as the event payload.
- Transformed the event by adding a new attribute to it
- Routed the event to an external Target: the TriggerMesh Console
- Throughout the quickstart, you'll monitor everything happening inside the Broker with the
Please make sure you are able to run docker containers on your machine before proceeding.
tmctl is the TriggerMesh command line interface (CLI) that makes it easy to work with events from the safety of your office (or couch).
TriggerMesh CLI can be installed from different sources: brew repository, pre-built binary, or compiled from source.
Use the following one-liner to automatically download and install the CLI:
Alternatively, visit the releases page to manually download the latest version for your platform and make sure the path of the downloaded binary is configured in the
PATH environment variable.
Visit the releases page to manually download the latest version for your platform and make sure the path of the downloaded binary is configured in the
PATH environment variable.
The most recent version of the
go compiler is recommended to build
tmctl binary from source:
Make sure that the binary's location is configured in the
PATH environment variable, like so:
Verify that the binary has been successfully installed:
To configure autocompletion for
tmctl, please refer to the dedicated guide.
Create a Broker and send it an event
Create a Broker
Your Broker will reliably route and deliver events from producers to consumers:
Watch events sent to the Broker
Open a second terminal to display all events passing through the broker. Keep this second terminal open throughout the quickstart.
Wait for this command to say complete and print
Send it an event
Back to the 1st terminal, and send an event to the Broker with JSON data:
Watching...terminal, you should see the event received by your Broker, something like this:
Copy any output and PLEASE TELL US NOW .
Add an external event source
Poll an external HTTP endpoint for events
Let's create external source:
eventType parameter we're saying that events from this source should be given the type
buzzword.phrase. This can be used later on for routing.
Watch the events
In the second terminal that is
Watching...the Broker, you should be regularly receiving some generated text:
2022/11/09 16:17:38 Watching...
"phrase": "Rapidiously Brand Covalent Architectures"
Route events from the Broker to the TriggerMesh Console
Create a target
Now let's send those events somewhere.
We're going to run a local service called TriggerMesh Console that is used to view events in the browser. Create a Target that points to this service and runs the necessary container with the following command:
After running this command, it should output a URL that you can open in your browser:
View events in TriggerMesh Console
Open this in your browser, and watch as a new event appears every 20 seconds:
If you still have
tmctl watch running in a second terminal, you'll also see events there when they hit the Broker, before passing on to the Console.
Transform the event
Lets transform the incoming events before they are passed to the Console.
Create a transformation
Using TriggerMesh's Bumbleebee transformation component, we can easily modify an event as it passes through the TriggerMesh.
This simple transformation adds a new key to the event's JSON payload. We're using the
--target parameter to indicate that the transformed events should be passed along to the Console.
Send an event
Although you can wait till the HTTPPoller fetches another event, you can also simulate you own event with the following command:
Notice how events displayed in the Console now include the additional field that was added by the transformation.
View your TriggerMesh configuration
Run the following command:
As you can see,
tmctl describe displays useful info about your current configuration. It lists all the sources, targets, triggers, and other components you've defined, and their properties.
~ % tmctl describe
Trigger Target Filter
foo-trigger-a73dcb65 foo-transformation type is buzzword.phrase
foo-trigger-0a1c285d console type is foo-transformation.output
Transformation EventTypes Status
foo-transformation foo-transformation.output online(http://localhost:53205)
Source Kind EventTypes Status
foo-httppollersource httppollersource buzzword.phrase online(http://localhost:53069)
Target Kind Expected Events Status
console service (gcr.io/triggermesh/triggermesh-console:v0.0.1) * online(http://localhost:53098)
Now that you know what a source, target, and transformation are, you can start doing more things! Like creating your own Trigger, or adding new sources and targets that make sense to you.
create your first Trigger:
- head to the Trigger guide to learn about Triggers.
- try ingesting Azure events by using the Azure Event Hubs source
- or sending events to Azure Sentinel for threat analysis
Google Cloud users:
- try ingesting Google events using the Google Pub/Sub Source
- or sending events to Google Cloud Workflows
- try ingesting events over standard HTTP with the Webhook Source or with CloudEvents over HTTP with the CloudEvents Source
- or sending events over HTTP with fine control over HTTP parameters with the HTTP Target, or using CloudEvents over HTTP with the CloudEvents Target.
- try exporting your local configuration as a Kubernetes manifest by using
tmctl dump, and deploying to a cluster. You can learn more about it in the dedicated guide.
After running through this quickstart guide, you'll have a number of containers running on Docker.
You can stop all TriggerMesh-related containers with:
To delete you local configuration (all sources, targets, brokers, transformations) and stop all containers, you can try:
foo with the name of your broker. Be careful, you can't go back once you've deleted everything.