Skip to content

ActiveMQ

Spout for AMQP

Bases: Spout

__init__(output, state, **kwargs)

Initialize the RabbitMQ class.

Parameters:

Name Type Description Default
output StreamingOutput

An instance of the StreamingOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius RabbitMQ rise \
    streaming \
        --output_kafka_topic rabbitmq_test \
        --output_kafka_cluster_connection_string localhost:9094 \
    none \
    listen \
        --args queue_name=my_queue host=localhost

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_rabbitmq_spout:
        name: "RabbitMQ"
        method: "listen"
        args:
            queue_name: "my_queue"
            host: "localhost"
        output:
            type: "streaming"
            args:
                output_topic: "rabbitmq_test"
                kafka_servers: "localhost:9094"

listen(queue_name, host='localhost', username=None, password=None)

📖 Start listening for data from the RabbitMQ server.

Parameters:

Name Type Description Default
queue_name str

The RabbitMQ queue name to listen to.

required
host str

The RabbitMQ server host. Defaults to "localhost".

'localhost'
username Optional[str]

The username for authentication. Defaults to None.

None
password Optional[str]

The password for authentication. Defaults to None.

None

Raises:

Type Description
Exception

If unable to connect to the RabbitMQ server.