Skip to content

Commit

Permalink
feat(AsyncAPI 2.6.0): Channel - Operation
Browse files Browse the repository at this point in the history
- Operation draft
- Channel, Message, Operation Bindings draft

asyncapi#126
  • Loading branch information
Pakisan committed Feb 10, 2023
1 parent c6ab595 commit 21f77fb
Show file tree
Hide file tree
Showing 102 changed files with 3,587 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.asyncapi.v2._6_0.binding.channel;

import lombok.EqualsAndHashCode;

/**
* Describes AsyncAPI channel binding.
*
* @author Pavel Bodiachevskii
*/
@EqualsAndHashCode
public class ChannelBinding {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package com.asyncapi.v2._6_0.binding.channel.amqp;

import com.asyncapi.v2._6_0.binding.channel.ChannelBinding;
import lombok.*;

import javax.annotation.CheckForNull;

/**
* Describes AMQP 0-9-1 channel binding.
* <p>
* Contains information about the channel representation in AMQP.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/amqp#channel-binding-object">AMQP channel binding</a>
* @author Pavel Bodiachevskii
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AMQPChannelBinding extends ChannelBinding {

/**
* Defines what type of channel is it. Can be either queue or routingKey (default).
*/
@CheckForNull
private String is;

/**
* When is=routingKey, this object defines the exchange properties.
*/
@CheckForNull
private ExchangeProperties exchange;

/**
* When is=queue, this object defines the queue properties.
*/
@CheckForNull
private QueueProperties queue;

@CheckForNull
@Builder.Default
private String bindingVersion = "0.2.0";

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public static class ExchangeProperties {

/**
* The name of the exchange. It MUST NOT exceed 255 characters long.
*/
@CheckForNull
private String name;

/**
* The type of the exchange. Can be either topic, direct, fanout, default or headers.
*/
@CheckForNull
private String type;

/**
* Whether the exchange should survive broker restarts or not.
*/
@CheckForNull
private Boolean durable;

/**
* Whether the exchange should be deleted when the last queue is unbound from it.
*/
@CheckForNull
private Boolean autoDelete;

/**
* The virtual host of the exchange. Defaults to /.
*/
@CheckForNull
@Builder.Default
private String vhost = "/";

}

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public static class QueueProperties {

/**
* The name of the queue. It MUST NOT exceed 255 characters long.
*/
@CheckForNull
private String name;

/**
* Whether the queue should survive broker restarts or not.
*/
@CheckForNull
private Boolean durable;

/**
* Whether the queue should be used only by one connection or not.
*/
@CheckForNull
private Boolean exclusive;

/**
* Whether the queue should be deleted when the last consumer unsubscribes.
*/
@CheckForNull
private Boolean autoDelete;

/**
* The virtual host of the queue. Defaults to /.
*/
@CheckForNull
@Builder.Default
private String vhost = "/";

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.asyncapi.v2._6_0.binding.channel.amqp1;

import com.asyncapi.v2.binding.ChannelBinding;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
* <p>
* Describes AMQP 1.0 channel binding.
*
* @version 0.1.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/amqp1#channel-binding-object">AMQP channel binding</a>
* @author Pavel Bodiachevskii
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AMQP1ChannelBinding extends ChannelBinding {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.asyncapi.v2._6_0.binding.channel.anypointmq;

import com.asyncapi.v2._6_0.binding.channel.ChannelBinding;
import lombok.*;

import javax.annotation.CheckForNull;

/**
* Describes Anypoint MQ channel binding.
*
* @version 0.0.1
* @see <a href="https://github.com/asyncapi/bindings/blob/master/anypointmq/README.md#channel-binding-object">Anypoint MQ channel binding</a>
* @author Pavel Bodiachevskii
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AnypointMQChannelBinding extends ChannelBinding {

/**
* OPTIONAL, defaults to the channel name.
* <p>
* The destination (queue or exchange) name for this channel. SHOULD only be specified if the channel name differs
* from the actual destination name, such as when the channel name is not a valid destination name in Anypoint MQ.
*/
@CheckForNull
private String destination;

/**
* OPTIONAL, defaults to queue.
* <p>
* The type of destination, which MUST be either exchange or queue or fifo-queue.
* SHOULD be specified to document the messaging model (publish/subscribe, point-to-point, strict message ordering)
* supported by this channel.
*/
@CheckForNull
private String destinationType;

/**
* OPTIONAL, defaults to latest. The version of this binding.
*/
@CheckForNull
@Builder.Default
private String bindingVersion = "0.0.1";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
package com.asyncapi.v2._6_0.binding.channel.googlepubsub;

import com.asyncapi.v2._6_0.binding.message.MessageBinding;
import lombok.*;

import javax.annotation.CheckForNull;
import java.util.List;
import java.util.Map;

/**
* The Channel Bindings Object is used to describe the Google Cloud Pub/Sub specific <a href="https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create">Topic</a> details with AsyncAPI.
* <p>
* Describes Google Cloud Pub/Sub channel binding.
*
* @version 0.1.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/googlepubsub">Google Cloud Pub/Sub channel binding</a>
* @author Pavel Bodiachevskii
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class GooglePubSubChannelBinding extends MessageBinding {

/**
* The Google Cloud Pub/Sub Topic name
*/
private String topic;

/**
* An object of key-value pairs (These are used to categorize Cloud Resources like Cloud Pub/Sub Topics.)
*/
@CheckForNull
private Map<String, Object> labels;

/**
* Indicates the minimum duration to retain a message after it is published to the topic (Must be a valid <a href="https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration">Duration</a>.)
*/
@CheckForNull
private String messageRetentionDuration;

/**
* Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored
*/
@CheckForNull
private MessageStoragePolicy messageStoragePolicy;

/**
* Settings for validating messages published against a schema
*/
@CheckForNull
private SchemaSettings schemaSettings;

/**
* OPTIONAL, defaults to latest. The version of this binding.
*/
@CheckForNull
@Builder.Default
private String bindingVersion = "0.1.0";

/**
* The Message Storage Policy Object is used to describe the Google Cloud Pub/Sub <a href="https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#MessageStoragePolicy">MessageStoragePolicy</a> Object with AsyncAPI.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public static class MessageStoragePolicy {

/**
* A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
*/
@CheckForNull
private List<String> allowedPersistenceRegions;

}

/**
* The Schema Settings Object is used to describe the Google Cloud Pub/Sub <a href="https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#SchemaSettings">SchemaSettings</a> Object with AsyncAPI.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public static class SchemaSettings {

/**
* The encoding of the message (Must be one of the possible <a href="https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#encoding">Encoding</a> values.)
*/
@CheckForNull
private String encoding;

/**
* The minimum (inclusive) revision allowed for validating messages
*/
@CheckForNull
private String firstRevisionId;

/**
* The maximum (inclusive) revision allowed for validating messages
*/
@CheckForNull
private String lastRevisionId;

/**
* The name of the schema that messages published should be validated against (The format is projects/{project}/schemas/{schema}.)
*/
@CheckForNull
private String name;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.asyncapi.v2._6_0.binding.channel.http;

import com.asyncapi.v2._6_0.binding.channel.ChannelBinding;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
* <p>
* Describes HTTP channel binding.
*
* @version 0.1.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/http#channel-binding-object">HTTP channel binding</a>
* @author Pavel Bodiachevskii
*/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class HTTPChannelBinding extends ChannelBinding {
}
Loading

0 comments on commit 21f77fb

Please sign in to comment.