-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to describe exchange and routing key for AMQP consumer and producer #69
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.github.stavshamir.springwolf.asyncapi.serializers; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we need this at this point - currently the binding tab in the UI displays only the operation binding, so this will appear only in the document itself. It's ok to have it serialized as it is without this custom serializer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it because the endpoint wouldn't work, it resulted in a 500 internal error failing to serialize the channelBinding field. Is there other way to fix this problem? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm ok, so let's keep it, I can figure it out later. |
||
|
||
|
||
import com.asyncapi.v2.binding.kafka.KafkaChannelBinding; | ||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
|
||
import java.io.IOException; | ||
|
||
public class KafkaChannelBindingSerializer extends StdSerializer<KafkaChannelBinding> { | ||
|
||
public KafkaChannelBindingSerializer() { | ||
this(null); | ||
} | ||
|
||
public KafkaChannelBindingSerializer(Class<KafkaChannelBinding> t) { | ||
super(t); | ||
} | ||
|
||
@Override | ||
public void serialize(KafkaChannelBinding value, JsonGenerator gen, SerializerProvider provider) throws IOException { | ||
gen.writeStartObject(); | ||
gen.writeEndObject(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package io.github.stavshamir.springwolf.asyncapi.types; | ||
|
||
import com.asyncapi.v2.binding.ChannelBinding; | ||
import com.asyncapi.v2.binding.OperationBinding; | ||
import lombok.*; | ||
|
||
|
@@ -20,19 +21,29 @@ public class ProducerData { | |
*/ | ||
private String channelName; | ||
|
||
/** | ||
* The channel binding of the producer. | ||
* <br> | ||
* For example: | ||
* <code> | ||
* ImmutableMap.of("kafka", new KafkaChannelBinding()) | ||
* </code> | ||
*/ | ||
private Map<String, ? extends ChannelBinding> channelBinding; | ||
|
||
/** | ||
* The class object of the payload published by this producer. | ||
*/ | ||
private Class<?> payloadType; | ||
|
||
/** | ||
* The binding of the producer. | ||
* The operation binding of the producer. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should change the name of this field to |
||
* <br> | ||
* For example: | ||
* <code> | ||
* ImmutableMap.of("kafka", new KafkaOperationBinding()) | ||
* </code> | ||
*/ | ||
private Map<String, ? extends OperationBinding> binding; | ||
private Map<String, ? extends OperationBinding> operationBinding; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment in
KafkaChannelBindingSerializer
.