Git Product home page Git Product logo

interface-kafka's Introduction

Overview

This interface layer handles the communication between Kafka and its clients. The provider part of this interface provides the Kafka service. The consumer part requires the existence of a provider to function.

Usage

Provides

Charms providing the Apache Kafka service provide this interface. This interface layer will set the following states, as appropriate:

  • {relation_name}.joined The provider has been related to a client, though the client service may not be available yet. At this point, the provider should broadcast Kafka configuration details using:

    • send_port(self, port)
    • send_zookeepers(self, zk_host_port_pair_list)
  • {relation_name}.ready Kafka configuration details have been sent. The provider and client should now be able to communicate.

Kafka provider example:

@when('client.joined', 'zookeeper.ready')
def serve_client(client, zookeeper):
    client.send_port(get_kafka_port())
    client.send_zookeepers(zookeeper.zookeepers())

Requires

Clients require this interface to connect to Apache Kafka. This interface layer will set the following states, as appropriate:

  • {relation_name}.joined The client charm has been related to a Kafka provider. At this point, the charm waits for Kafka configuration details.

  • {relation_name}.ready Kafka is now ready for clients. The client charm should get Kafka configuration details using:

    • kafkas()
    • zookeepers()

Kafka client example:

@when('kafka.joined')
@when_not('kafka.ready')
def wait_for_kafka(kafka):
    hookenv.status_set('waiting', 'Waiting for Kafka to become ready')


@when('kafka.ready')
@when_not('myservice.configured')
def configure(kafka):
    for kafka_unit in kafka.kafkas():
        add_kafka(kafka_unit['host'], kafka_unit['port'])
    set_state('myservice.configured')

Contact Information

interface-kafka's People

Contributors

johnsca avatar ktsakalozos avatar kwmonroe avatar pengale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.