Channel

Struct Channel 

Source
pub struct Channel {
    pub reference: Option<String>,
    pub description: Option<String>,
    pub servers: Vec<String>,
    pub subscribe: Option<Operation>,
    pub publish: Option<Operation>,
    pub parameters: IndexMap<String, ReferenceOr<Parameter>>,
    pub bindings: Option<ReferenceOr<ChannelBinding>>,
    pub extensions: IndexMap<String, Value>,
}
Expand description

Describes the operations available on a single channel.

§Examples

{
    "description": "This channel is used to exchange messages about users signing up",
    "subscribe": {
        "summary": "A user signed up.",
        "message": {
        "description": "A longer description of the message",
        "payload": {
            "type": "object",
            "properties": {
            "user": {
                "$ref": "#/components/schemas/user"
            },
            "signup": {
                "$ref": "#/components/schemas/signup"
            }
            }
        }
        }
    },
    "bindings": {
        "amqp": {
        "is": "queue",
        "queue": {
            "exclusive": true
        }
        }
    }
}
description: This channel is used to exchange messages about users signing up
subscribe:
  summary: A user signed up.
  message:
    description: A longer description of the message
    payload:
      type: object
      properties:
        user:
          $ref: "#/components/schemas/user"
        signup:
bindings:
  amqp:
    is: queue
    queue:
      exclusive: true

Using oneOf to specify multiple messages per operation:

{
    "subscribe": {
        "message": {
        "oneOf": [
            { "$ref": "#/components/messages/signup" },
            { "$ref": "#/components/messages/login" }
        ]
        }
    }
}
subscribe:
  message:
    oneOf:
      - $ref: '#/components/messages/signup'
      - $ref: '#/components/messages/login'

Fields§

§reference: Option<String>
👎Deprecated: The $ref field in Channel Item Object is now deprecated from AsyncAPI 2.3.0. The current plan is that the $ref field will be removed from Channel Item Object in AsyncAPI 3.0, and replaced with Reference Object.

Allows for an external definition of this channel item. The referenced structure MUST be in the format of a Channel Item Object. If there are conflicts between the referenced definition and this Channel Item’s definition, the behavior is undefined.

§description: Option<String>

An optional description of this channel item. CommonMark syntax can be used for rich text representation.

§servers: Vec<String>

The servers on which this channel is available, specified as an optional unordered list of names (string keys) of Server Objects defined in the Servers Object (a map). If servers is absent or empty then this channel must be available on all servers defined in the Servers Object.

§subscribe: Option<Operation>

A definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel.

§publish: Option<Operation>

A definition of the PUBLISH operation, which defines the messages consumed by the application from the channel.

§parameters: IndexMap<String, ReferenceOr<Parameter>>

A map of the parameters included in the channel name. It SHOULD be present only when using channels with expressions (as defined by RFC 6570 section 2.2).

Describes a map of parameters included in a channel name.

This map MUST contain all the parameters used in the parent channel name.

§Examples

{
    "user/{userId}/signup": {
        "parameters": {
            "userId": {
                "description": "Id of the user.",
                "schema": {
                   "type": "string"
                }
            }
        },
        "subscribe": {
            "$ref": "#/components/messages/userSignedUp"
        }
    }
}
user/{userId}/signup:
  parameters:
    userId:
      description: Id of the user.
      schema:
        type: string
  subscribe:
    $ref: "#/components/messages/userSignedUp"
§bindings: Option<ReferenceOr<ChannelBinding>>

A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the channel.

§extensions: IndexMap<String, Value>

This object can be extended with Specification Extensions.

Trait Implementations§

Source§

impl Clone for Channel

Source§

fn clone(&self) -> Channel

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Channel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Channel

Source§

fn default() -> Channel

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Channel

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Channel

Source§

fn eq(&self, other: &Channel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Channel

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Channel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,