1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. amqp
  5. Exchange
Alibaba Cloud v3.78.0 published on Friday, May 16, 2025 by Pulumi

alicloud.amqp.Exchange

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.78.0 published on Friday, May 16, 2025 by Pulumi

    Provides a RabbitMQ (AMQP) Exchange resource.

    For information about RabbitMQ (AMQP) Exchange and how to use it, see What is Exchange.

    NOTE: Available since v1.128.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const virtualHostName = config.get("virtualHostName") || "/";
    const createInstance = new alicloud.amqp.Instance("CreateInstance", {
        renewalDuration: 1,
        maxTps: "3000",
        periodCycle: "Month",
        maxConnections: 2000,
        supportEip: true,
        autoRenew: false,
        renewalStatus: "AutoRenewal",
        period: 12,
        instanceName: name,
        supportTracing: false,
        paymentType: "Subscription",
        renewalDurationUnit: "Month",
        instanceType: "enterprise",
        queueCapacity: "200",
        maxEipTps: "128",
        storageSize: "0",
    });
    const _default = new alicloud.amqp.Exchange("default", {
        virtualHostName: virtualHostName,
        instanceId: createInstance.id,
        internal: true,
        autoDeleteState: false,
        exchangeName: name,
        exchangeType: "X_CONSISTENT_HASH",
        alternateExchange: "bakExchange",
        xDelayedType: "DIRECT",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    virtual_host_name = config.get("virtualHostName")
    if virtual_host_name is None:
        virtual_host_name = "/"
    create_instance = alicloud.amqp.Instance("CreateInstance",
        renewal_duration=1,
        max_tps="3000",
        period_cycle="Month",
        max_connections=2000,
        support_eip=True,
        auto_renew=False,
        renewal_status="AutoRenewal",
        period=12,
        instance_name=name,
        support_tracing=False,
        payment_type="Subscription",
        renewal_duration_unit="Month",
        instance_type="enterprise",
        queue_capacity="200",
        max_eip_tps="128",
        storage_size="0")
    default = alicloud.amqp.Exchange("default",
        virtual_host_name=virtual_host_name,
        instance_id=create_instance.id,
        internal=True,
        auto_delete_state=False,
        exchange_name=name,
        exchange_type="X_CONSISTENT_HASH",
        alternate_exchange="bakExchange",
        x_delayed_type="DIRECT")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/amqp"
    	"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, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		virtualHostName := "/"
    		if param := cfg.Get("virtualHostName"); param != "" {
    			virtualHostName = param
    		}
    		createInstance, err := amqp.NewInstance(ctx, "CreateInstance", &amqp.InstanceArgs{
    			RenewalDuration:     pulumi.Int(1),
    			MaxTps:              pulumi.String("3000"),
    			PeriodCycle:         pulumi.String("Month"),
    			MaxConnections:      pulumi.Int(2000),
    			SupportEip:          pulumi.Bool(true),
    			AutoRenew:           pulumi.Bool(false),
    			RenewalStatus:       pulumi.String("AutoRenewal"),
    			Period:              pulumi.Int(12),
    			InstanceName:        pulumi.String(name),
    			SupportTracing:      pulumi.Bool(false),
    			PaymentType:         pulumi.String("Subscription"),
    			RenewalDurationUnit: pulumi.String("Month"),
    			InstanceType:        pulumi.String("enterprise"),
    			QueueCapacity:       pulumi.String("200"),
    			MaxEipTps:           pulumi.String("128"),
    			StorageSize:         pulumi.String("0"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = amqp.NewExchange(ctx, "default", &amqp.ExchangeArgs{
    			VirtualHostName:   pulumi.String(virtualHostName),
    			InstanceId:        createInstance.ID(),
    			Internal:          pulumi.Bool(true),
    			AutoDeleteState:   pulumi.Bool(false),
    			ExchangeName:      pulumi.String(name),
    			ExchangeType:      pulumi.String("X_CONSISTENT_HASH"),
    			AlternateExchange: pulumi.String("bakExchange"),
    			XDelayedType:      pulumi.String("DIRECT"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var virtualHostName = config.Get("virtualHostName") ?? "/";
        var createInstance = new AliCloud.Amqp.Instance("CreateInstance", new()
        {
            RenewalDuration = 1,
            MaxTps = "3000",
            PeriodCycle = "Month",
            MaxConnections = 2000,
            SupportEip = true,
            AutoRenew = false,
            RenewalStatus = "AutoRenewal",
            Period = 12,
            InstanceName = name,
            SupportTracing = false,
            PaymentType = "Subscription",
            RenewalDurationUnit = "Month",
            InstanceType = "enterprise",
            QueueCapacity = "200",
            MaxEipTps = "128",
            StorageSize = "0",
        });
    
        var @default = new AliCloud.Amqp.Exchange("default", new()
        {
            VirtualHostName = virtualHostName,
            InstanceId = createInstance.Id,
            Internal = true,
            AutoDeleteState = false,
            ExchangeName = name,
            ExchangeType = "X_CONSISTENT_HASH",
            AlternateExchange = "bakExchange",
            XDelayedType = "DIRECT",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.amqp.Instance;
    import com.pulumi.alicloud.amqp.InstanceArgs;
    import com.pulumi.alicloud.amqp.Exchange;
    import com.pulumi.alicloud.amqp.ExchangeArgs;
    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 name = config.get("name").orElse("tf-example");
            final var virtualHostName = config.get("virtualHostName").orElse("/");
            var createInstance = new Instance("createInstance", InstanceArgs.builder()
                .renewalDuration(1)
                .maxTps("3000")
                .periodCycle("Month")
                .maxConnections(2000)
                .supportEip(true)
                .autoRenew(false)
                .renewalStatus("AutoRenewal")
                .period(12)
                .instanceName(name)
                .supportTracing(false)
                .paymentType("Subscription")
                .renewalDurationUnit("Month")
                .instanceType("enterprise")
                .queueCapacity("200")
                .maxEipTps("128")
                .storageSize("0")
                .build());
    
            var default_ = new Exchange("default", ExchangeArgs.builder()
                .virtualHostName(virtualHostName)
                .instanceId(createInstance.id())
                .internal(true)
                .autoDeleteState(false)
                .exchangeName(name)
                .exchangeType("X_CONSISTENT_HASH")
                .alternateExchange("bakExchange")
                .xDelayedType("DIRECT")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
      virtualHostName:
        type: string
        default: /
    resources:
      createInstance:
        type: alicloud:amqp:Instance
        name: CreateInstance
        properties:
          renewalDuration: '1'
          maxTps: '3000'
          periodCycle: Month
          maxConnections: '2000'
          supportEip: true
          autoRenew: false
          renewalStatus: AutoRenewal
          period: '12'
          instanceName: ${name}
          supportTracing: false
          paymentType: Subscription
          renewalDurationUnit: Month
          instanceType: enterprise
          queueCapacity: '200'
          maxEipTps: '128'
          storageSize: '0'
      default:
        type: alicloud:amqp:Exchange
        properties:
          virtualHostName: ${virtualHostName}
          instanceId: ${createInstance.id}
          internal: 'true'
          autoDeleteState: 'false'
          exchangeName: ${name}
          exchangeType: X_CONSISTENT_HASH
          alternateExchange: bakExchange
          xDelayedType: DIRECT
    

    Create Exchange Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Exchange(name: string, args: ExchangeArgs, opts?: CustomResourceOptions);
    @overload
    def Exchange(resource_name: str,
                 args: ExchangeArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Exchange(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 auto_delete_state: Optional[bool] = None,
                 exchange_name: Optional[str] = None,
                 exchange_type: Optional[str] = None,
                 instance_id: Optional[str] = None,
                 internal: Optional[bool] = None,
                 virtual_host_name: Optional[str] = None,
                 alternate_exchange: Optional[str] = None,
                 x_delayed_type: Optional[str] = None)
    func NewExchange(ctx *Context, name string, args ExchangeArgs, opts ...ResourceOption) (*Exchange, error)
    public Exchange(string name, ExchangeArgs args, CustomResourceOptions? opts = null)
    public Exchange(String name, ExchangeArgs args)
    public Exchange(String name, ExchangeArgs args, CustomResourceOptions options)
    
    type: alicloud:amqp:Exchange
    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 ExchangeArgs
    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 ExchangeArgs
    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 ExchangeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ExchangeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ExchangeArgs
    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 exchangeResource = new AliCloud.Amqp.Exchange("exchangeResource", new()
    {
        AutoDeleteState = false,
        ExchangeName = "string",
        ExchangeType = "string",
        InstanceId = "string",
        Internal = false,
        VirtualHostName = "string",
        AlternateExchange = "string",
        XDelayedType = "string",
    });
    
    example, err := amqp.NewExchange(ctx, "exchangeResource", &amqp.ExchangeArgs{
    	AutoDeleteState:   pulumi.Bool(false),
    	ExchangeName:      pulumi.String("string"),
    	ExchangeType:      pulumi.String("string"),
    	InstanceId:        pulumi.String("string"),
    	Internal:          pulumi.Bool(false),
    	VirtualHostName:   pulumi.String("string"),
    	AlternateExchange: pulumi.String("string"),
    	XDelayedType:      pulumi.String("string"),
    })
    
    var exchangeResource = new Exchange("exchangeResource", ExchangeArgs.builder()
        .autoDeleteState(false)
        .exchangeName("string")
        .exchangeType("string")
        .instanceId("string")
        .internal(false)
        .virtualHostName("string")
        .alternateExchange("string")
        .xDelayedType("string")
        .build());
    
    exchange_resource = alicloud.amqp.Exchange("exchangeResource",
        auto_delete_state=False,
        exchange_name="string",
        exchange_type="string",
        instance_id="string",
        internal=False,
        virtual_host_name="string",
        alternate_exchange="string",
        x_delayed_type="string")
    
    const exchangeResource = new alicloud.amqp.Exchange("exchangeResource", {
        autoDeleteState: false,
        exchangeName: "string",
        exchangeType: "string",
        instanceId: "string",
        internal: false,
        virtualHostName: "string",
        alternateExchange: "string",
        xDelayedType: "string",
    });
    
    type: alicloud:amqp:Exchange
    properties:
        alternateExchange: string
        autoDeleteState: false
        exchangeName: string
        exchangeType: string
        instanceId: string
        internal: false
        virtualHostName: string
        xDelayedType: string
    

    Exchange 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 Exchange resource accepts the following input properties:

    AutoDeleteState bool
    Specifies whether to automatically delete the exchange. Valid values:
    ExchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    ExchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    InstanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    Internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    VirtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    AlternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    XDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    AutoDeleteState bool
    Specifies whether to automatically delete the exchange. Valid values:
    ExchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    ExchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    InstanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    Internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    VirtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    AlternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    XDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    autoDeleteState Boolean
    Specifies whether to automatically delete the exchange. Valid values:
    exchangeName String
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType String
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId String
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal Boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName String
    The name of the vhost to which the exchange that you want to create belongs.
    alternateExchange String
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    xDelayedType String
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    autoDeleteState boolean
    Specifies whether to automatically delete the exchange. Valid values:
    exchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    alternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    xDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    auto_delete_state bool
    Specifies whether to automatically delete the exchange. Valid values:
    exchange_name str
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchange_type str
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instance_id str
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    virtual_host_name str
    The name of the vhost to which the exchange that you want to create belongs.
    alternate_exchange str
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    x_delayed_type str
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    autoDeleteState Boolean
    Specifies whether to automatically delete the exchange. Valid values:
    exchangeName String
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType String
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId String
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal Boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName String
    The name of the vhost to which the exchange that you want to create belongs.
    alternateExchange String
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    xDelayedType String
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.

    Outputs

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

    CreateTime int
    CreateTime
    Id string
    The provider-assigned unique ID for this managed resource.
    CreateTime int
    CreateTime
    Id string
    The provider-assigned unique ID for this managed resource.
    createTime Integer
    CreateTime
    id String
    The provider-assigned unique ID for this managed resource.
    createTime number
    CreateTime
    id string
    The provider-assigned unique ID for this managed resource.
    create_time int
    CreateTime
    id str
    The provider-assigned unique ID for this managed resource.
    createTime Number
    CreateTime
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Exchange Resource

    Get an existing Exchange 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?: ExchangeState, opts?: CustomResourceOptions): Exchange
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alternate_exchange: Optional[str] = None,
            auto_delete_state: Optional[bool] = None,
            create_time: Optional[int] = None,
            exchange_name: Optional[str] = None,
            exchange_type: Optional[str] = None,
            instance_id: Optional[str] = None,
            internal: Optional[bool] = None,
            virtual_host_name: Optional[str] = None,
            x_delayed_type: Optional[str] = None) -> Exchange
    func GetExchange(ctx *Context, name string, id IDInput, state *ExchangeState, opts ...ResourceOption) (*Exchange, error)
    public static Exchange Get(string name, Input<string> id, ExchangeState? state, CustomResourceOptions? opts = null)
    public static Exchange get(String name, Output<String> id, ExchangeState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:amqp:Exchange    get:      id: ${id}
    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:
    AlternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    AutoDeleteState bool
    Specifies whether to automatically delete the exchange. Valid values:
    CreateTime int
    CreateTime
    ExchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    ExchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    InstanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    Internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    VirtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    XDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    AlternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    AutoDeleteState bool
    Specifies whether to automatically delete the exchange. Valid values:
    CreateTime int
    CreateTime
    ExchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    ExchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    InstanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    Internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    VirtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    XDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    alternateExchange String
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    autoDeleteState Boolean
    Specifies whether to automatically delete the exchange. Valid values:
    createTime Integer
    CreateTime
    exchangeName String
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType String
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId String
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal Boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName String
    The name of the vhost to which the exchange that you want to create belongs.
    xDelayedType String
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    alternateExchange string
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    autoDeleteState boolean
    Specifies whether to automatically delete the exchange. Valid values:
    createTime number
    CreateTime
    exchangeName string
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType string
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId string
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName string
    The name of the vhost to which the exchange that you want to create belongs.
    xDelayedType string
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    alternate_exchange str
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    auto_delete_state bool
    Specifies whether to automatically delete the exchange. Valid values:
    create_time int
    CreateTime
    exchange_name str
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchange_type str
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instance_id str
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal bool
    Specifies whether the exchange is an internal exchange. Valid values:
    virtual_host_name str
    The name of the vhost to which the exchange that you want to create belongs.
    x_delayed_type str
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.
    alternateExchange String
    The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.
    autoDeleteState Boolean
    Specifies whether to automatically delete the exchange. Valid values:
    createTime Number
    CreateTime
    exchangeName String
    The name of the exchange that you want to create. The exchange name must meet the following conventions:

    • The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    • After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.
    exchangeType String
    The Exchange type. Value:

    • DIRECT: This type of Routing rule routes messages to a Queue whose Binding Key matches the Routing Key.
    • TOPIC: This type is similar to the DIRECT type. It uses Routing Key pattern matching and string comparison to route messages to the bound Queue.
    • FANOUT: This type of routing rule is very simple. It routes all messages sent to the Exchange to all queues bound to it, which is equivalent to the broadcast function.
    • HEADERS: This type is similar to the DIRECT type. Headers Exchange uses the Headers attribute instead of Routing Key for route matching. When binding Headers Exchange and Queue, the Key-value pair of the bound attribute is set. When sending a message to Headers Exchange, the Headers attribute Key-value pair of the message is set, and the message is routed to the bound Queue by comparing the Headers attribute Key-value pair with the bound attribute Key-value pair.
    • X_delayed_message: By declaring this type of Exchange, you can customize the Header attribute x-delay of the message to specify the delivery delay time period, in milliseconds. Messages will be delivered to the corresponding Queue after the time period defined in the x-delay according to the routing rules. The routing rule depends on the Exchange route type specified in the x-delayed-type.
    • X_CONSISTENT_HASH: The x-consistent-hash Exchange allows you to Hash the Routing Key or Header value and use the consistent hashing algorithm to route messages to different queues.
    instanceId String
    The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.
    internal Boolean
    Specifies whether the exchange is an internal exchange. Valid values:
    virtualHostName String
    The name of the vhost to which the exchange that you want to create belongs.
    xDelayedType String
    RabbitMQ supports the x-delayed-message Exchange. By declaring this type of Exchange, you can customize the x-delay header attribute to specify the delay period for message delivery, measured in milliseconds. The message will be delivered to the corresponding Queue after the period defined in x-delay. The routing rules are determined by the type of Exchange specified in x-delayed-type.

    Import

    RabbitMQ (AMQP) Exchange can be imported using the id, e.g.

    $ pulumi import alicloud:amqp/exchange:Exchange example <instance_id>:<virtual_host_name>:<exchange_name>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.78.0 published on Friday, May 16, 2025 by Pulumi