Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Queue

The rabbitmq.Queue resource creates and manages a queue.

Example Usage

Basic Example

using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;

class MyStack : Stack
{
    public MyStack()
    {
        var testVHost = new RabbitMQ.VHost("testVHost", new RabbitMQ.VHostArgs
        {
        });
        var guest = new RabbitMQ.Permissions("guest", new RabbitMQ.PermissionsArgs
        {
            Permissions = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Read = ".*",
                Write = ".*",
            },
            User = "guest",
            Vhost = testVHost.Name,
        });
        var testQueue = new RabbitMQ.Queue("testQueue", new RabbitMQ.QueueArgs
        {
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                AutoDelete = true,
                Durable = false,
            },
            Vhost = guest.Vhost,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-rabbitmq/sdk/v2/go/rabbitmq"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        testVHost, err := rabbitmq.NewVHost(ctx, "testVHost", nil)
        if err != nil {
            return err
        }
        guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
            Permissions: &rabbitmq.PermissionsPermissionsArgs{
                Configure: pulumi.String(".*"),
                Read:      pulumi.String(".*"),
                Write:     pulumi.String(".*"),
            },
            User:  pulumi.String("guest"),
            Vhost: testVHost.Name,
        })
        if err != nil {
            return err
        }
        _, err = rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
            Settings: &rabbitmq.QueueSettingsArgs{
                AutoDelete: pulumi.Bool(true),
                Durable:    pulumi.Bool(false),
            },
            Vhost: guest.Vhost,
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_rabbitmq as rabbitmq

test_v_host = rabbitmq.VHost("testVHost")
guest = rabbitmq.Permissions("guest",
    permissions=rabbitmq.PermissionsPermissionsArgs(
        configure=".*",
        read=".*",
        write=".*",
    ),
    user="guest",
    vhost=test_v_host.name)
test_queue = rabbitmq.Queue("testQueue",
    settings=rabbitmq.QueueSettingsArgs(
        auto_delete=True,
        durable=False,
    ),
    vhost=guest.vhost)
import * as pulumi from "@pulumi/pulumi";
import * as rabbitmq from "@pulumi/rabbitmq";

const testVHost = new rabbitmq.VHost("test", {});
const guest = new rabbitmq.Permissions("guest", {
    permissions: {
        configure: ".*",
        read: ".*",
        write: ".*",
    },
    user: "guest",
    vhost: testVHost.name,
});
const testQueue = new rabbitmq.Queue("test", {
    settings: {
        autoDelete: true,
        durable: false,
    },
    vhost: guest.vhost,
});

Example With JSON Arguments

using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var arguments = config.Get("arguments") ?? @"{
  ""x-message-ttl"": 5000
}

";
        var testVHost = new RabbitMQ.VHost("testVHost", new RabbitMQ.VHostArgs
        {
        });
        var guest = new RabbitMQ.Permissions("guest", new RabbitMQ.PermissionsArgs
        {
            Permissions = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Read = ".*",
                Write = ".*",
            },
            User = "guest",
            Vhost = testVHost.Name,
        });
        var testQueue = new RabbitMQ.Queue("testQueue", new RabbitMQ.QueueArgs
        {
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                ArgumentsJson = arguments,
                AutoDelete = true,
                Durable = false,
            },
            Vhost = guest.Vhost,
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-rabbitmq/sdk/v2/go/rabbitmq"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi/config"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        cfg := config.New(ctx, "")
        arguments := fmt.Sprintf("%v%v%v%v", "{\n", "  \"x-message-ttl\": 5000\n", "}\n", "\n")
        if param := cfg.Get("arguments"); param != "" {
            arguments = param
        }
        testVHost, err := rabbitmq.NewVHost(ctx, "testVHost", nil)
        if err != nil {
            return err
        }
        guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
            Permissions: &rabbitmq.PermissionsPermissionsArgs{
                Configure: pulumi.String(".*"),
                Read:      pulumi.String(".*"),
                Write:     pulumi.String(".*"),
            },
            User:  pulumi.String("guest"),
            Vhost: testVHost.Name,
        })
        if err != nil {
            return err
        }
        _, err = rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
            Settings: &rabbitmq.QueueSettingsArgs{
                ArgumentsJson: pulumi.String(arguments),
                AutoDelete:    pulumi.Bool(true),
                Durable:       pulumi.Bool(false),
            },
            Vhost: guest.Vhost,
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_rabbitmq as rabbitmq

config = pulumi.Config()
arguments = config.get("arguments")
if arguments is None:
    arguments = """{
  "x-message-ttl": 5000
}

"""
test_v_host = rabbitmq.VHost("testVHost")
guest = rabbitmq.Permissions("guest",
    permissions=rabbitmq.PermissionsPermissionsArgs(
        configure=".*",
        read=".*",
        write=".*",
    ),
    user="guest",
    vhost=test_v_host.name)
test_queue = rabbitmq.Queue("testQueue",
    settings=rabbitmq.QueueSettingsArgs(
        arguments_json=arguments,
        auto_delete=True,
        durable=False,
    ),
    vhost=guest.vhost)
import * as pulumi from "@pulumi/pulumi";
import * as rabbitmq from "@pulumi/rabbitmq";

const config = new pulumi.Config();
const arguments = config.get("arguments") || `{
  "x-message-ttl": 5000
}
`;

const testVHost = new rabbitmq.VHost("test", {});
const guest = new rabbitmq.Permissions("guest", {
    permissions: {
        configure: ".*",
        read: ".*",
        write: ".*",
    },
    user: "guest",
    vhost: testVHost.name,
});
const testQueue = new rabbitmq.Queue("test", {
    settings: {
        argumentsJson: arguments,
        autoDelete: true,
        durable: false,
    },
    vhost: guest.vhost,
});

Create a Queue Resource

new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);
def Queue(resource_name: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, settings: Optional[QueueSettingsArgs] = None, vhost: Optional[str] = None)
func NewQueue(ctx *Context, name string, args QueueArgs, opts ...ResourceOption) (*Queue, error)
public Queue(string name, QueueArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args QueueArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Queue Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Queue resource accepts the following input properties:

Settings Pulumi.RabbitMQ.Inputs.QueueSettingsArgs

The settings of the queue. The structure is described below.

Name string

The name of the queue.

Vhost string

The vhost to create the resource in.

Settings QueueSettings

The settings of the queue. The structure is described below.

Name string

The name of the queue.

Vhost string

The vhost to create the resource in.

settings QueueSettings

The settings of the queue. The structure is described below.

name string

The name of the queue.

vhost string

The vhost to create the resource in.

settings QueueSettingsArgs

The settings of the queue. The structure is described below.

name str

The name of the queue.

vhost str

The vhost to create the resource in.

Outputs

All input properties are implicitly available as output properties. Additionally, the Queue resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Queue Resource

Get an existing Queue resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: QueueState, opts?: CustomResourceOptions): Queue
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, settings: Optional[QueueSettingsArgs] = None, vhost: Optional[str] = None) -> Queue
func GetQueue(ctx *Context, name string, id IDInput, state *QueueState, opts ...ResourceOption) (*Queue, error)
public static Queue Get(string name, Input<string> id, QueueState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Name string

The name of the queue.

Settings Pulumi.RabbitMQ.Inputs.QueueSettingsArgs

The settings of the queue. The structure is described below.

Vhost string

The vhost to create the resource in.

Name string

The name of the queue.

Settings QueueSettings

The settings of the queue. The structure is described below.

Vhost string

The vhost to create the resource in.

name string

The name of the queue.

settings QueueSettings

The settings of the queue. The structure is described below.

vhost string

The vhost to create the resource in.

name str

The name of the queue.

settings QueueSettingsArgs

The settings of the queue. The structure is described below.

vhost str

The vhost to create the resource in.

Supporting Types

QueueSettings

Arguments Dictionary<string, object>

Additional key/value settings for the queue. All values will be sent to RabbitMQ as a string. If you require non-string values, use arguments_json.

ArgumentsJson string

A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.

AutoDelete bool

Whether the queue will self-delete when all consumers have unsubscribed.

Durable bool

Whether the queue survives server restarts. Defaults to false.

Arguments map[string]interface{}

Additional key/value settings for the queue. All values will be sent to RabbitMQ as a string. If you require non-string values, use arguments_json.

ArgumentsJson string

A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.

AutoDelete bool

Whether the queue will self-delete when all consumers have unsubscribed.

Durable bool

Whether the queue survives server restarts. Defaults to false.

arguments {[key: string]: any}

Additional key/value settings for the queue. All values will be sent to RabbitMQ as a string. If you require non-string values, use arguments_json.

argumentsJson string

A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.

autoDelete boolean

Whether the queue will self-delete when all consumers have unsubscribed.

durable boolean

Whether the queue survives server restarts. Defaults to false.

arguments Mapping[str, Any]

Additional key/value settings for the queue. All values will be sent to RabbitMQ as a string. If you require non-string values, use arguments_json.

arguments_json str

A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.

auto_delete bool

Whether the queue will self-delete when all consumers have unsubscribed.

durable bool

Whether the queue survives server restarts. Defaults to false.

Import

Queues can be imported using the id which is composed of name@vhost. E.g.

 $ pulumi import rabbitmq:index/queue:Queue test name@vhost

Package Details

Repository
https://github.com/pulumi/pulumi-rabbitmq
License
Apache-2.0
Notes
This Pulumi package is based on the rabbitmq Terraform Provider.