The isConnected custom metric has a special treatment in the cloud. It creates a warning when it has the value 0.
As the Kafka Java API is very high-level, and does not provide connection handling to the user, we could derive the isConnected state from the kafka metric connection-count:
Pseudo code:
isConnected = connection-count > 0? 1: 0;
Care must be taken to avoid a false warning when the producer has not yet produced, or the consumer has not yet assigned partitions. This can happen when the consumer input port is used, or when a pattern subscription is configured, and no topic is matching the pattern.
The isConnected custom metric has a special treatment in the cloud. It creates a warning when it has the value 0.
As the Kafka Java API is very high-level, and does not provide connection handling to the user, we could derive the isConnected state from the kafka metric connection-count:
Pseudo code:
Care must be taken to avoid a false warning when the producer has not yet produced, or the consumer has not yet assigned partitions. This can happen when the consumer input port is used, or when a pattern subscription is configured, and no topic is matching the pattern.