Channels

In order to instantiate a ZeebeWorker or ZeebeClient you will need to provide an instance of a grpc.aio.Channel.

Pyzeebe provides a couple standard ways to achieve this:

Insecure

Create a grpc channel connected to a Zeebe Gateway with tls disabled

pyzeebe.create_insecure_channel(hostname: Optional[str] = None, port: Optional[int] = None, channel_options: Optional[Dict[KT, VT]] = None) → grpc.aio._base_channel.Channel

Create an insecure channel

Parameters:
Returns:

A GRPC Channel connected to the Zeebe gateway.

Return type:

grpc.aio.Channel

Example:

from pyzeebe import create_insecure_channel

channel = create_insecure_channel(hostname="zeebe", port=443)

Secure

Create a grpc channel with a secure connection to a Zeebe Gateway with tls

pyzeebe.create_secure_channel(hostname: Optional[str] = None, port: Optional[int] = None, channel_options: Optional[Dict[KT, VT]] = None, channel_credentials: Optional[grpc.ChannelCredentials] = None) → grpc.aio._base_channel.Channel

Create a secure channel

Parameters:
  • hostname (Optional[str], optional) – Zeebe gateway hostname
  • port (Optional[int], optional) – Zeebe gateway port
  • channel_options (Optional[Dict], optional) – GRPC channel options. See https://grpc.github.io/grpc/python/glossary.html#term-channel_arguments
  • channel_credentials (Optional[grpc.ChannelCredentials]) – Channel credentials to use. Will use grpc.ssl_channel_credentials() if not provided.
Returns:

A GRPC Channel connected to the Zeebe gateway.

Return type:

grpc.aio.Channel

Example:

import grpc
from pyzeebe import create_secure_channel


grpc.ssl_channel_credentials(root_certificates="<root_certificate>", private_key="<private_key>")
channel = create_secure_channel(channel_credentials=credentials)

Camunda Cloud

Create a grpc channel connected to a Zeebe Gateway running in camunda cloud

pyzeebe.create_camunda_cloud_channel(client_id: str, client_secret: str, cluster_id: str, region: str = 'bru-2', channel_options: Optional[Dict[KT, VT]] = None) → grpc.aio._base_channel.Channel

Create channel connected to a Camunda Cloud cluster

Parameters:
  • client_id (str) – The client id provided by Camunda Cloud
  • client_secret (str) – The client secret provided by Camunda Cloud
  • cluster_id (str) – The zeebe cluster id to connect to
  • region (str) – The cluster’s region. Defaults to bru-2
  • channel_options (Optional[Dict], optional) – GRPC channel options. See https://grpc.github.io/grpc/python/glossary.html
Returns:

A GRPC Channel connected to the Zeebe gateway.

Return type:

grpc.aio.Channel

Raises:

InvalidCamundaCloudCredentialsError – One of the provided camunda credentials is not correct

Example:

from pyzeebe import create_camunda_cloud_channel


channel = create_camunda_cloud_channel("client_id", "client_secret", "cluster_id")