Kafka (Message queue service)
Back to home
On this page
Apache Kafka is an open-source stream-processing software platform.
It is a framework for storing, reading and analyzing streaming data. See the Kafka documentation for more information.
Supported versions
You can select the major and minor version.
Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.
- 3.2
- 3.4
Relationship reference
Example information available through the PLATFORM_RELATIONSHIPS environment variable
or by running upsun relationships.
Note that the information about the relationship can change when an app is redeployed or restarted
or the relationship is changed.
So your apps should only rely on the PLATFORM_RELATIONSHIPS environment variable directly rather than hard coding any values.
{
"service": "kafka25",
"ip": "169.254.27.10",
"hostname": "t7lv3t3ttyh3vyrzgqguj5upwy.kafka25.service._.eu-3.upsunapp.com",
"cluster": "rjify4yjcwxaa-master-7rqtwti",
"host": "kafka.internal",
"rel": "kafka",
"scheme": "kafka",
"type": "kafka:3.4",
"port": 9092
} Usage example
1. Configure the service
To define the service, use
the kafka type:
services:
# The name of the service container. Must be unique within a project.
<SERVICE_NAME>:
type: kafka:<VERSION>Note that changing the name of the service replaces it with a brand new service and all existing data is lost. Back up your data before changing the service.
2. Add the relationship
To define the relationship, use the kafka endpoint
:
applications:
# The name of the app container. Must be unique within a project.
<APP_NAME>:
# Relationships enable access from this app to a given service.
relationships:
<RELATIONSHIP_NAME>: "<SERVICE_NAME>:kafka"
services:
# The name of the service container. Must be unique within a project.
<SERVICE_NAME>:
type: kafka:<VERSION>You can define <SERVICE_NAME> and <RELATIONSHIP_NAME> as you like, but it’s best if they’re distinct.
With this definition, the application container (<APP_NAME>) now has access to the service via the relationship <RELATIONSHIP_NAME>.
Example Configuration
App and Service configuration
applications:
# The name of the app container. Must be unique within a project.
myapp:
# Relationships enable access from this app to a given service.
relationships:
kafkaqueue: "queuekafka:kafka"
services:
# The name of the service container. Must be unique within a project.
queuekafka:
type: kafka:3.4 Use in app
To use the configured service in your app, add a configuration file similar to the following to your project.
(The specific way to inject configuration into your application varies. Consult your application or framework’s documentation.)