Rabbitmq K8S

  • OpenStack Charmers
Channel Revision Published Runs on
3.12/stable 34 19 Sep 2024
Ubuntu 22.04
3.12/candidate 34 05 Apr 2024
Ubuntu 22.04
3.12/beta 39 03 Dec 2024
Ubuntu 24.04 Ubuntu 22.04
3.12/beta 37 10 Sep 2024
Ubuntu 24.04 Ubuntu 22.04
3.12/edge 39 27 Nov 2024
Ubuntu 24.04 Ubuntu 22.04
3.12/edge 37 31 Jul 2024
Ubuntu 24.04 Ubuntu 22.04
3.11/beta 10 10 Mar 2023
Ubuntu 22.04
3.11/edge 22 26 May 2023
Ubuntu 22.04
3.9/stable 30 26 Sep 2023
Ubuntu 22.04
3.9/candidate 30 12 Sep 2023
Ubuntu 22.04
3.9/beta 30 10 Jan 2024
Ubuntu 22.04
3.9/edge 30 12 Sep 2023
Ubuntu 22.04
juju deploy rabbitmq-k8s --channel 3.12/stable
Show information

Platform:

charms.rabbitmq_k8s.v0.rabbitmq

RabbitMQProvides and Requires module.

This library contains the Requires and Provides classes for handling the rabbitmq interface.

Import RabbitMQRequires in your charm, with the charm object and the relation name: - self - "amqp"

Also provide two additional parameters to the charm object: - username - vhost

Two events are also available to respond to: - connected - ready - goneaway

A basic example showing the usage of this relation follows:

from charms.rabbitmq_k8s.v0.rabbitmq import RabbitMQRequires

class RabbitMQClientCharm(CharmBase):
    def __init__(self, *args):
        super().__init__(*args)
        # RabbitMQ Requires
        self.amqp = RabbitMQRequires(
            self, "amqp",
            username="myusername",
            vhost="vhostname"
        )
        self.framework.observe(
            self.amqp.on.connected, self._on_amqp_connected)
        self.framework.observe(
            self.amqp.on.ready, self._on_amqp_ready)
        self.framework.observe(
            self.amqp.on.goneaway, self._on_amqp_goneaway)

    def _on_amqp_connected(self, event):
        '''React to the RabbitMQ connected event.

        This event happens when n RabbitMQ relation is added to the
        model before credentials etc have been provided.
        '''
        # Do something before the relation is complete
        pass

    def _on_amqp_ready(self, event):
        '''React to the RabbitMQ ready event.

        The RabbitMQ interface will use the provided username and vhost for the
        request to the rabbitmq server.
        '''
        # RabbitMQ Relation is ready. Do something with the completed relation.
        pass

    def _on_amqp_goneaway(self, event):
        '''React to the RabbitMQ goneaway event.

        This event happens when an RabbitMQ relation is removed.
        '''
        # RabbitMQ Relation has goneaway. shutdown services or suchlike
        pass

class RabbitMQConnectedEvent

Description

RabbitMQ connected Event. None

class RabbitMQReadyEvent

Description

RabbitMQ ready for use Event. None

class RabbitMQGoneAwayEvent

Description

RabbitMQ relation has gone-away Event None

class RabbitMQServerEvents

Description

Events class for on None

class RabbitMQRequires

Description

RabbitMQRequires class None

Methods

RabbitMQRequires. __init__( self , charm , relation_name: str , username: str , vhost: str )

RabbitMQRequires. password( self )

Description

Return the RabbitMQ password from the server side of the relation. None

RabbitMQRequires. hostname( self )

Description

Return the hostname from the RabbitMQ relation None

RabbitMQRequires. ssl_port( self )

Description

Return the SSL port from the RabbitMQ relation None

RabbitMQRequires. ssl_ca( self )

Description

Return the SSL port from the RabbitMQ relation None

RabbitMQRequires. hostnames( self )

Description

Return a list of remote RMQ hosts from the RabbitMQ relation None

RabbitMQRequires. request_access( self , username: str , vhost: str )

Description

Request access to the RabbitMQ server. None

class HasRabbitMQClientsEvent

Description

Has RabbitMQClients Event. None

class ReadyRabbitMQClientsEvent

Description

RabbitMQClients Ready Event. None

class RabbitMQClientEvents

Description

Events class for on None

class RabbitMQProvides

Description

RabbitMQProvides class None

Methods

RabbitMQProvides. __init__( self , charm , relation_name , callback )

RabbitMQProvides. username( self , event )

Description

Return the RabbitMQ username from the client side of the relation. None

RabbitMQProvides. vhost( self , event )

Description

Return the RabbitMQ vhost from the client side of the relation. None