1. Packages
  2. RabbitMQ
  3. API Docs
  4. Queue
RabbitMQ v3.3.1 published on Friday, Jan 19, 2024 by Pulumi

rabbitmq.Queue

Explore with Pulumi AI

rabbitmq logo
RabbitMQ v3.3.1 published on Friday, Jan 19, 2024 by Pulumi

    The rabbitmq.Queue resource creates and manages a queue.

    Example Usage

    Basic Example

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using RabbitMQ = Pulumi.RabbitMQ;
    
    return await Deployment.RunAsync(() => 
    {
        var testVHost = new RabbitMQ.VHost("testVHost");
    
        var guest = new RabbitMQ.Permissions("guest", new()
        {
            User = "guest",
            Vhost = testVHost.Name,
            PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Write = ".*",
                Read = ".*",
            },
        });
    
        var testQueue = new RabbitMQ.Queue("testQueue", new()
        {
            Vhost = guest.Vhost,
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                Durable = false,
                AutoDelete = true,
                Arguments = 
                {
                    { "x-queue-type", "quorum" },
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rabbitmq/sdk/v3/go/rabbitmq"
    	"github.com/pulumi/pulumi/sdk/v3/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{
    			User:  pulumi.String("guest"),
    			Vhost: testVHost.Name,
    			Permissions: &rabbitmq.PermissionsPermissionsArgs{
    				Configure: pulumi.String(".*"),
    				Write:     pulumi.String(".*"),
    				Read:      pulumi.String(".*"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
    			Vhost: guest.Vhost,
    			Settings: &rabbitmq.QueueSettingsArgs{
    				Durable:    pulumi.Bool(false),
    				AutoDelete: pulumi.Bool(true),
    				Arguments: pulumi.Map{
    					"x-queue-type": pulumi.Any("quorum"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rabbitmq.VHost;
    import com.pulumi.rabbitmq.Permissions;
    import com.pulumi.rabbitmq.PermissionsArgs;
    import com.pulumi.rabbitmq.inputs.PermissionsPermissionsArgs;
    import com.pulumi.rabbitmq.Queue;
    import com.pulumi.rabbitmq.QueueArgs;
    import com.pulumi.rabbitmq.inputs.QueueSettingsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var testVHost = new VHost("testVHost");
    
            var guest = new Permissions("guest", PermissionsArgs.builder()        
                .user("guest")
                .vhost(testVHost.name())
                .permissions(PermissionsPermissionsArgs.builder()
                    .configure(".*")
                    .write(".*")
                    .read(".*")
                    .build())
                .build());
    
            var testQueue = new Queue("testQueue", QueueArgs.builder()        
                .vhost(guest.vhost())
                .settings(QueueSettingsArgs.builder()
                    .durable(false)
                    .autoDelete(true)
                    .arguments(Map.of("x-queue-type", "quorum"))
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_rabbitmq as rabbitmq
    
    test_v_host = rabbitmq.VHost("testVHost")
    guest = rabbitmq.Permissions("guest",
        user="guest",
        vhost=test_v_host.name,
        permissions=rabbitmq.PermissionsPermissionsArgs(
            configure=".*",
            write=".*",
            read=".*",
        ))
    test_queue = rabbitmq.Queue("testQueue",
        vhost=guest.vhost,
        settings=rabbitmq.QueueSettingsArgs(
            durable=False,
            auto_delete=True,
            arguments={
                "x-queue-type": "quorum",
            },
        ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as rabbitmq from "@pulumi/rabbitmq";
    
    const testVHost = new rabbitmq.VHost("testVHost", {});
    const guest = new rabbitmq.Permissions("guest", {
        user: "guest",
        vhost: testVHost.name,
        permissions: {
            configure: ".*",
            write: ".*",
            read: ".*",
        },
    });
    const testQueue = new rabbitmq.Queue("testQueue", {
        vhost: guest.vhost,
        settings: {
            durable: false,
            autoDelete: true,
            arguments: {
                "x-queue-type": "quorum",
            },
        },
    });
    
    resources:
      testVHost:
        type: rabbitmq:VHost
      guest:
        type: rabbitmq:Permissions
        properties:
          user: guest
          vhost: ${testVHost.name}
          permissions:
            configure: .*
            write: .*
            read: .*
      testQueue:
        type: rabbitmq:Queue
        properties:
          vhost: ${guest.vhost}
          settings:
            durable: false
            autoDelete: true
            arguments:
              x-queue-type: quorum
    

    Example With JSON Arguments

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using RabbitMQ = Pulumi.RabbitMQ;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var arguments = config.Get("arguments") ?? @"{
      ""x-message-ttl"": 5000
    }
    
    ";
        var testVHost = new RabbitMQ.VHost("testVHost");
    
        var guest = new RabbitMQ.Permissions("guest", new()
        {
            PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Read = ".*",
                Write = ".*",
            },
            User = "guest",
            Vhost = testVHost.Name,
        });
    
        var testQueue = new RabbitMQ.Queue("testQueue", new()
        {
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                ArgumentsJson = arguments,
                AutoDelete = true,
                Durable = false,
            },
            Vhost = guest.Vhost,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rabbitmq/sdk/v3/go/rabbitmq"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		arguments := "{\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
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rabbitmq.VHost;
    import com.pulumi.rabbitmq.Permissions;
    import com.pulumi.rabbitmq.PermissionsArgs;
    import com.pulumi.rabbitmq.inputs.PermissionsPermissionsArgs;
    import com.pulumi.rabbitmq.Queue;
    import com.pulumi.rabbitmq.QueueArgs;
    import com.pulumi.rabbitmq.inputs.QueueSettingsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var arguments = config.get("arguments").orElse("""
    {
      "x-message-ttl": 5000
    }
    
            """);
            var testVHost = new VHost("testVHost");
    
            var guest = new Permissions("guest", PermissionsArgs.builder()        
                .permissions(PermissionsPermissionsArgs.builder()
                    .configure(".*")
                    .read(".*")
                    .write(".*")
                    .build())
                .user("guest")
                .vhost(testVHost.name())
                .build());
    
            var testQueue = new Queue("testQueue", QueueArgs.builder()        
                .settings(QueueSettingsArgs.builder()
                    .argumentsJson(arguments)
                    .autoDelete(true)
                    .durable(false)
                    .build())
                .vhost(guest.vhost())
                .build());
    
        }
    }
    
    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("testVHost", {});
    const guest = new rabbitmq.Permissions("guest", {
        permissions: {
            configure: ".*",
            read: ".*",
            write: ".*",
        },
        user: "guest",
        vhost: testVHost.name,
    });
    const testQueue = new rabbitmq.Queue("testQueue", {
        settings: {
            argumentsJson: arguments,
            autoDelete: true,
            durable: false,
        },
        vhost: guest.vhost,
    });
    
    configuration:
      arguments:
        type: string
        default: |+
          {
            "x-message-ttl": 5000
          }      
    
    resources:
      testVHost:
        type: rabbitmq:VHost
      guest:
        type: rabbitmq:Permissions
        properties:
          permissions:
            configure: .*
            read: .*
            write: .*
          user: guest
          vhost: ${testVHost.name}
      testQueue:
        type: rabbitmq:Queue
        properties:
          settings:
            argumentsJson: ${arguments}
            autoDelete: true
            durable: false
          vhost: ${guest.vhost}
    

    Create Queue Resource

    new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);
    @overload
    def Queue(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              name: Optional[str] = None,
              settings: Optional[QueueSettingsArgs] = None,
              vhost: Optional[str] = None)
    @overload
    def Queue(resource_name: str,
              args: QueueArgs,
              opts: Optional[ResourceOptions] = None)
    func NewQueue(ctx *Context, name string, args QueueArgs, opts ...ResourceOption) (*Queue, error)
    public Queue(string name, QueueArgs args, CustomResourceOptions? opts = null)
    public Queue(String name, QueueArgs args)
    public Queue(String name, QueueArgs args, CustomResourceOptions options)
    
    type: rabbitmq:Queue
    properties: # The arguments to resource properties.
    options: # 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.
    resource_name str
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args QueueArgs
    The arguments to resource properties.
    options 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 Architecture and Concepts docs.

    Inputs

    The Queue resource accepts the following input properties:

    Settings Pulumi.RabbitMQ.Inputs.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 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.
    settings Property Map
    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.

    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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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)
    public static Queue get(String name, Output<String> id, QueueState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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.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 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.
    name String
    The name of the queue.
    settings Property Map
    The settings of the queue. The structure is described below.
    vhost String
    The vhost to create the resource in.

    Supporting Types

    QueueSettings, QueueSettingsArgs

    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 Map<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 Boolean
    Whether the queue will self-delete when all consumers have unsubscribed.
    durable Boolean
    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.
    arguments Map<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.

    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
    RabbitMQ pulumi/pulumi-rabbitmq
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the rabbitmq Terraform Provider.
    rabbitmq logo
    RabbitMQ v3.3.1 published on Friday, Jan 19, 2024 by Pulumi