rabbitmq.Queue
Explore with Pulumi AI
The rabbitmq.Queue
resource creates and manages a queue.
Example Usage
Basic Example
import * as pulumi from "@pulumi/pulumi";
import * as rabbitmq from "@pulumi/rabbitmq";
const test = new rabbitmq.VHost("test", {name: "test"});
const guest = new rabbitmq.Permissions("guest", {
user: "guest",
vhost: test.name,
permissions: {
configure: ".*",
write: ".*",
read: ".*",
},
});
const testQueue = new rabbitmq.Queue("test", {
name: "test",
vhost: guest.vhost,
settings: {
durable: false,
autoDelete: true,
arguments: {
"x-queue-type": "quorum",
},
},
});
import pulumi
import pulumi_rabbitmq as rabbitmq
test = rabbitmq.VHost("test", name="test")
guest = rabbitmq.Permissions("guest",
user="guest",
vhost=test.name,
permissions={
"configure": ".*",
"write": ".*",
"read": ".*",
})
test_queue = rabbitmq.Queue("test",
name="test",
vhost=guest.vhost,
settings={
"durable": False,
"auto_delete": 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 {
test, err := rabbitmq.NewVHost(ctx, "test", &rabbitmq.VHostArgs{
Name: pulumi.String("test"),
})
if err != nil {
return err
}
guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
User: pulumi.String("guest"),
Vhost: test.Name,
Permissions: &rabbitmq.PermissionsPermissionsArgs{
Configure: pulumi.String(".*"),
Write: pulumi.String(".*"),
Read: pulumi.String(".*"),
},
})
if err != nil {
return err
}
_, err = rabbitmq.NewQueue(ctx, "test", &rabbitmq.QueueArgs{
Name: pulumi.String("test"),
Vhost: guest.Vhost,
Settings: &rabbitmq.QueueSettingsArgs{
Durable: pulumi.Bool(false),
AutoDelete: pulumi.Bool(true),
Arguments: pulumi.StringMap{
"x-queue-type": pulumi.String("quorum"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;
return await Deployment.RunAsync(() =>
{
var test = new RabbitMQ.VHost("test", new()
{
Name = "test",
});
var guest = new RabbitMQ.Permissions("guest", new()
{
User = "guest",
Vhost = test.Name,
PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
{
Configure = ".*",
Write = ".*",
Read = ".*",
},
});
var testQueue = new RabbitMQ.Queue("test", new()
{
Name = "test",
Vhost = guest.Vhost,
Settings = new RabbitMQ.Inputs.QueueSettingsArgs
{
Durable = false,
AutoDelete = true,
Arguments =
{
{ "x-queue-type", "quorum" },
},
},
});
});
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.VHostArgs;
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 test = new VHost("test", VHostArgs.builder()
.name("test")
.build());
var guest = new Permissions("guest", PermissionsArgs.builder()
.user("guest")
.vhost(test.name())
.permissions(PermissionsPermissionsArgs.builder()
.configure(".*")
.write(".*")
.read(".*")
.build())
.build());
var testQueue = new Queue("testQueue", QueueArgs.builder()
.name("test")
.vhost(guest.vhost())
.settings(QueueSettingsArgs.builder()
.durable(false)
.autoDelete(true)
.arguments(Map.of("x-queue-type", "quorum"))
.build())
.build());
}
}
resources:
test:
type: rabbitmq:VHost
properties:
name: test
guest:
type: rabbitmq:Permissions
properties:
user: guest
vhost: ${test.name}
permissions:
configure: .*
write: .*
read: .*
testQueue:
type: rabbitmq:Queue
name: test
properties:
name: test
vhost: ${guest.vhost}
settings:
durable: false
autoDelete: true
arguments:
x-queue-type: quorum
Example With JSON Arguments
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 test = new rabbitmq.VHost("test", {name: "test"});
const guest = new rabbitmq.Permissions("guest", {
user: "guest",
vhost: test.name,
permissions: {
configure: ".*",
write: ".*",
read: ".*",
},
});
const testQueue = new rabbitmq.Queue("test", {
name: "test",
vhost: guest.vhost,
settings: {
durable: false,
autoDelete: true,
argumentsJson: arguments,
},
});
import pulumi
import pulumi_rabbitmq as rabbitmq
config = pulumi.Config()
arguments = config.get("arguments")
if arguments is None:
arguments = """{
"x-message-ttl": 5000
}
"""
test = rabbitmq.VHost("test", name="test")
guest = rabbitmq.Permissions("guest",
user="guest",
vhost=test.name,
permissions={
"configure": ".*",
"write": ".*",
"read": ".*",
})
test_queue = rabbitmq.Queue("test",
name="test",
vhost=guest.vhost,
settings={
"durable": False,
"auto_delete": True,
"arguments_json": arguments,
})
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"
if param := cfg.Get("arguments"); param != "" {
arguments = param
}
test, err := rabbitmq.NewVHost(ctx, "test", &rabbitmq.VHostArgs{
Name: pulumi.String("test"),
})
if err != nil {
return err
}
guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
User: pulumi.String("guest"),
Vhost: test.Name,
Permissions: &rabbitmq.PermissionsPermissionsArgs{
Configure: pulumi.String(".*"),
Write: pulumi.String(".*"),
Read: pulumi.String(".*"),
},
})
if err != nil {
return err
}
_, err = rabbitmq.NewQueue(ctx, "test", &rabbitmq.QueueArgs{
Name: pulumi.String("test"),
Vhost: guest.Vhost,
Settings: &rabbitmq.QueueSettingsArgs{
Durable: pulumi.Bool(false),
AutoDelete: pulumi.Bool(true),
ArgumentsJson: pulumi.String(arguments),
},
})
if err != nil {
return err
}
return nil
})
}
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 test = new RabbitMQ.VHost("test", new()
{
Name = "test",
});
var guest = new RabbitMQ.Permissions("guest", new()
{
User = "guest",
Vhost = test.Name,
PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
{
Configure = ".*",
Write = ".*",
Read = ".*",
},
});
var testQueue = new RabbitMQ.Queue("test", new()
{
Name = "test",
Vhost = guest.Vhost,
Settings = new RabbitMQ.Inputs.QueueSettingsArgs
{
Durable = false,
AutoDelete = true,
ArgumentsJson = arguments,
},
});
});
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.VHostArgs;
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 test = new VHost("test", VHostArgs.builder()
.name("test")
.build());
var guest = new Permissions("guest", PermissionsArgs.builder()
.user("guest")
.vhost(test.name())
.permissions(PermissionsPermissionsArgs.builder()
.configure(".*")
.write(".*")
.read(".*")
.build())
.build());
var testQueue = new Queue("testQueue", QueueArgs.builder()
.name("test")
.vhost(guest.vhost())
.settings(QueueSettingsArgs.builder()
.durable(false)
.autoDelete(true)
.argumentsJson(arguments)
.build())
.build());
}
}
configuration:
arguments:
type: string
default: |
{
"x-message-ttl": 5000
}
resources:
test:
type: rabbitmq:VHost
properties:
name: test
guest:
type: rabbitmq:Permissions
properties:
user: guest
vhost: ${test.name}
permissions:
configure: .*
write: .*
read: .*
testQueue:
type: rabbitmq:Queue
name: test
properties:
name: test
vhost: ${guest.vhost}
settings:
durable: false
autoDelete: true
argumentsJson: ${arguments}
Create Queue Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Queue(name: string, args: QueueArgs, opts?: CustomResourceOptions);
@overload
def Queue(resource_name: str,
args: QueueArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Queue(resource_name: str,
opts: Optional[ResourceOptions] = None,
settings: Optional[QueueSettingsArgs] = None,
name: Optional[str] = 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)
type: rabbitmq:Queue
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var queueResource = new RabbitMQ.Queue("queueResource", new()
{
Settings = new RabbitMQ.Inputs.QueueSettingsArgs
{
Arguments =
{
{ "string", "string" },
},
ArgumentsJson = "string",
AutoDelete = false,
Durable = false,
},
Name = "string",
Vhost = "string",
});
example, err := rabbitmq.NewQueue(ctx, "queueResource", &rabbitmq.QueueArgs{
Settings: &rabbitmq.QueueSettingsArgs{
Arguments: pulumi.StringMap{
"string": pulumi.String("string"),
},
ArgumentsJson: pulumi.String("string"),
AutoDelete: pulumi.Bool(false),
Durable: pulumi.Bool(false),
},
Name: pulumi.String("string"),
Vhost: pulumi.String("string"),
})
var queueResource = new Queue("queueResource", QueueArgs.builder()
.settings(QueueSettingsArgs.builder()
.arguments(Map.of("string", "string"))
.argumentsJson("string")
.autoDelete(false)
.durable(false)
.build())
.name("string")
.vhost("string")
.build());
queue_resource = rabbitmq.Queue("queueResource",
settings={
"arguments": {
"string": "string",
},
"arguments_json": "string",
"auto_delete": False,
"durable": False,
},
name="string",
vhost="string")
const queueResource = new rabbitmq.Queue("queueResource", {
settings: {
arguments: {
string: "string",
},
argumentsJson: "string",
autoDelete: false,
durable: false,
},
name: "string",
vhost: "string",
});
type: rabbitmq:Queue
properties:
name: string
settings:
arguments:
string: string
argumentsJson: string
autoDelete: false
durable: false
vhost: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Queue resource accepts the following input properties:
- Settings
Pulumi.
Rabbit MQ. Inputs. Queue Settings - 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
Queue
Settings Args - 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
Queue
Settings - 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
Queue
Settings - 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
Queue
Settings Args - 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.
- Name string
- The name of the queue.
- Settings
Pulumi.
Rabbit MQ. Inputs. Queue Settings - 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
Queue
Settings Args - 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
Queue
Settings - 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
Queue
Settings - 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
Queue
Settings Args - 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, string>
- 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 string - 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[string]string
- 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 string - 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<String,String>
- 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 String - A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.
- auto
Delete 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]: string}
- 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 string - A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.
- auto
Delete 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, str]
- 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<String>
- 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 String - A nested JSON string which contains additional settings for the queue. This is useful for when the arguments contain non-string values.
- auto
Delete 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- RabbitMQ pulumi/pulumi-rabbitmq
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
rabbitmq
Terraform Provider.