Skip to content

Commit

Permalink
Merge pull request #6 from SolaceLabs/solace-updates
Browse files Browse the repository at this point in the history
Add Solace bindings and extension fields
  • Loading branch information
Pakisan authored Feb 15, 2023
2 parents a0eac2a + 726ced1 commit aec9541
Show file tree
Hide file tree
Showing 22 changed files with 480 additions and 17 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,12 @@ buildNumber.properties

# Mac
.DS_Store

# Eclipse
asyncapi-plugin/asyncapi-plugin-maven/.settings/org.eclipse.jdt.core.prefs
asyncapi-plugin/asyncapi-plugin-maven/.project
asyncapi-plugin/.project
asyncapi-core/.project
.vscode/settings.json
asyncapi-core/.settings/org.eclipse.jdt.core.prefs
.project
4 changes: 2 additions & 2 deletions asyncapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>asyncapi</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-EAP-1</version>
<version>1.0.1-EAP-1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -28,7 +28,7 @@
<!-- Tests -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.asyncapi.v2.binding.nats.NATSChannelBinding;
import com.asyncapi.v2.binding.redis.RedisChannelBinding;
import com.asyncapi.v2.binding.sns.SNSChannelBinding;
import com.asyncapi.v2.binding.solace.SolaceChannelBinding;
import com.asyncapi.v2.binding.sqs.SQSChannelBinding;
import com.asyncapi.v2.binding.stomp.STOMPChannelBinding;
import com.asyncapi.v2.binding.ws.WebSocketsChannelBinding;
Expand Down Expand Up @@ -68,6 +69,7 @@ private <T extends ChannelBinding> T chooseKnownPojo(String bindingKey, JsonNode
case "nats": return (T) objectMapper.readValue(binding.toString(), NATSChannelBinding.class);
case "redis": return (T) objectMapper.readValue(binding.toString(), RedisChannelBinding.class);
case "sns": return (T) objectMapper.readValue(binding.toString(), SNSChannelBinding.class);
case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceChannelBinding.class);
case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSChannelBinding.class);
case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPChannelBinding.class);
case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsChannelBinding.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.asyncapi.v2.binding.nats.NATSMessageBinding;
import com.asyncapi.v2.binding.redis.RedisMessageBinding;
import com.asyncapi.v2.binding.sns.SNSMessageBinding;
import com.asyncapi.v2.binding.solace.SolaceMessageBinding;
import com.asyncapi.v2.binding.sqs.SQSMessageBinding;
import com.asyncapi.v2.binding.stomp.STOMPMessageBinding;
import com.asyncapi.v2.binding.ws.WebSocketsMessageBinding;
Expand Down Expand Up @@ -68,6 +69,7 @@ private <T extends MessageBinding> T chooseKnownPojo(String bindingKey, JsonNode
case "nats": return (T) objectMapper.readValue(binding.toString(), NATSMessageBinding.class);
case "redis": return (T) objectMapper.readValue(binding.toString(), RedisMessageBinding.class);
case "sns": return (T) objectMapper.readValue(binding.toString(), SNSMessageBinding.class);
case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceMessageBinding.class);
case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSMessageBinding.class);
case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPMessageBinding.class);
case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsMessageBinding.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.asyncapi.v2.binding.nats.NATSOperationBinding;
import com.asyncapi.v2.binding.redis.RedisOperationBinding;
import com.asyncapi.v2.binding.sns.SNSOperationBinding;
import com.asyncapi.v2.binding.solace.SolaceOperationBinding;
import com.asyncapi.v2.binding.sqs.SQSOperationBinding;
import com.asyncapi.v2.binding.stomp.STOMPOperationBinding;
import com.asyncapi.v2.binding.ws.WebSocketsOperationBinding;
Expand Down Expand Up @@ -68,6 +69,7 @@ private <T extends OperationBinding> T chooseKnownPojo(String bindingKey, JsonNo
case "nats": return (T) objectMapper.readValue(binding.toString(), NATSOperationBinding.class);
case "redis": return (T) objectMapper.readValue(binding.toString(), RedisOperationBinding.class);
case "sns": return (T) objectMapper.readValue(binding.toString(), SNSOperationBinding.class);
case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceOperationBinding.class);
case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSOperationBinding.class);
case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPOperationBinding.class);
case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsOperationBinding.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.asyncapi.v2.binding.nats.NATSServerBinding;
import com.asyncapi.v2.binding.redis.RedisServerBinding;
import com.asyncapi.v2.binding.sns.SNSServerBinding;
import com.asyncapi.v2.binding.solace.SolaceServerBinding;
import com.asyncapi.v2.binding.sqs.SQSServerBinding;
import com.asyncapi.v2.binding.stomp.STOMPServerBinding;
import com.asyncapi.v2.binding.ws.WebSocketsServerBinding;
Expand Down Expand Up @@ -68,6 +69,7 @@ private <T extends ServerBinding> T chooseKnownPojo(String bindingKey, JsonNode
case "nats": return (T) objectMapper.readValue(binding.toString(), NATSServerBinding.class);
case "redis": return (T) objectMapper.readValue(binding.toString(), RedisServerBinding.class);
case "sns": return (T) objectMapper.readValue(binding.toString(), SNSServerBinding.class);
case "solace": return (T) objectMapper.readValue(binding.toString(), SolaceServerBinding.class);
case "sqs": return (T) objectMapper.readValue(binding.toString(), SQSServerBinding.class);
case "stomp": return (T) objectMapper.readValue(binding.toString(), STOMPServerBinding.class);
case "ws": return (T) objectMapper.readValue(binding.toString(), WebSocketsServerBinding.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.asyncapi.v2.binding.solace;

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

/**
* Describes Solace channel binding.
*
* Contains information about the channel representation in Solace PubSub+ Broker.
* This object MUST NOT contain any properties. Its name is reserved for future use.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/solace#channel-binding-object">Solace channel binding</a>
* @author Dennis Brinley
*/
@Data
@Builder
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SolaceChannelBinding extends ChannelBinding {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.asyncapi.v2.binding.solace;

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

/**
* Describes Solace message binding.
*
* Contains information about the message representation in Solace PubSub+ Broker.
* This object MUST NOT contain any properties. Its name is reserved for future use.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/solace#message-binding-object">Solace message binding</a>
* @author Dennis Brinley
*/
@Data
@Builder
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SolaceMessageBinding extends MessageBinding {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
package com.asyncapi.v2.binding.solace;

import com.asyncapi.v2.binding.OperationBinding;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

import lombok.*;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
* Describes Solace operation binding.
*
* Contains information about the operation representation in Solace PubSub+ Broker.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/solace#operation-binding-object">Solace operation binding</a>
* @author Dennis Brinley
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SolaceOperationBinding extends OperationBinding {

/**
* Version of the binding object (e.g. bindingVersion: 0.2.0)
*/
@Nullable
@CheckForNull
@JsonProperty
protected String bindingVersion;

/**
* List of destinations
*/
@Nullable
@CheckForNull
@Builder.Default
protected List<SolaceDestination> destinations = new ArrayList<SolaceDestination>();

public enum SolaceDestinationType {
QUEUE("queue"),
TOPIC("topic");

private String value;

private SolaceDestinationType(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}

@JsonValue
public String getValue() {
return value;
}

public static SolaceDestinationType fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException( "Value cannot be empty or NULL" );
}

for (SolaceDestinationType enumEntry : SolaceDestinationType.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}

throw new IllegalArgumentException( "Value must be member of [ queue, topic ]" );
}
}

public enum SolaceDeliveryModeType {
DIRECT("direct"),
PERISTENT("persistent");

private String value;

private SolaceDeliveryModeType(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}

@JsonValue
public String getValue() {
return this.value;
}

public static SolaceDeliveryModeType fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException( "Value cannot be empty or NULL" );
}

for (SolaceDeliveryModeType enumEntry : SolaceDeliveryModeType.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}

throw new IllegalArgumentException( "Value must be member of [ direct, persistent ]" );
}
}

public enum SolaceQueueAccessType {
EXCLUSIVE("exclusive"),
NON_EXCLUSIVE("non-exclusive");

private String value;

private SolaceQueueAccessType(String value) {
this.value = value;
}

@Override
public String toString() {
return this.value;
}

@JsonValue
public String getValue() {
return this.value;
}

public static SolaceQueueAccessType fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException( "Value cannot be empty or NULL" );
}

for (SolaceQueueAccessType enumEntry : SolaceQueueAccessType.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}

throw new IllegalArgumentException( "Value must be member of [ exclusive, non-exclusive ]" );
}
}

@Data
@NoArgsConstructor
@AllArgsConstructor
public static class SolaceQueueType {

@NonNull
@Nonnull
@CheckForNull
String name;

@CheckForNull
List<String> topicSubscriptions;

@CheckForNull
SolaceQueueAccessType accessType;
}

@Data
@NoArgsConstructor
@AllArgsConstructor
public static class SolaceTopicType {

@CheckForNull
@JsonProperty
protected List<String> topicSubscriptions;
}

@Data
@NoArgsConstructor
@AllArgsConstructor
public static class SolaceDestination {

/**
* The destination type. enum SolaceDestinationType enum can be 'topic' or 'queue'
*/
@NonNull
@Nonnull
@CheckForNull
@JsonProperty
protected SolaceDestinationType destinationType;

/**
* The delivery mode for messages associated with this destination. enum SolaceDeliveryModeType
* can be 'direct' or 'persistent'
*/
@NonNull
@Nonnull
@CheckForNull
@JsonProperty
protected SolaceDeliveryModeType deliveryMode;

/**
* Solace queue destination details.
*/
@Nullable
@CheckForNull
@JsonProperty
protected SolaceQueueType queue;

/**
* Solace topic destination details
*/
@Nullable
@CheckForNull
@JsonProperty
protected SolaceTopicType topic;
}

}
Loading

0 comments on commit aec9541

Please sign in to comment.