polishing
This commit is contained in:
@@ -1108,10 +1108,10 @@ Besides the conversions that it supports out of the box, Spring Cloud Stream als
|
||||
This allows you to send and receive data in a variety of custom formats, including binary, and associate them with specific `contentTypes`.
|
||||
Spring Cloud Stream registers all the beans of type `org.springframework.messaging.converter.MessageConverter` as custom message converters along with the out of the box message converters.
|
||||
|
||||
If your message converter needs to work with specific `content-type` and the target class (for both input and output), then the message converter needs to extend `org.springframework.messaging.converter.AbstractMessageConverter`.
|
||||
For the conversion using @StreamListener, the message converter that implements `org.springframework.messaging.converter.MessageConverter` would be suffice.
|
||||
If your message converter needs to work with a specific `content-type` and target class (for both input and output), then the message converter needs to extend `org.springframework.messaging.converter.AbstractMessageConverter`.
|
||||
For conversion when using `@StreamListener`, a message converter that implements `org.springframework.messaging.converter.MessageConverter` would suffice.
|
||||
|
||||
Here is an example of creating a message converter bean (with the content-type application/bar) inside the Spring Cloud Stream application:
|
||||
Here is an example of creating a message converter bean (with the content-type `application/bar`) inside a Spring Cloud Stream application:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@@ -1137,9 +1137,9 @@ public class MyCustomMessageConverter extends AbstractMessageConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supports(Class<?> clazz) {
|
||||
return (Bar.class == clazz);
|
||||
}
|
||||
protected boolean supports(Class<?> clazz) {
|
||||
return (Bar.class == clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
|
||||
@@ -1168,7 +1168,8 @@ If the target type of the conversion is a `GenericRecord`, then a schema must be
|
||||
|
||||
For using it, you can simply add it to the application context, optionally specifying one ore more `MimeTypes` to associate it with.
|
||||
The default `MimeType` is `application/avro`.
|
||||
Here is an example of configuring it in a sink application registering the Apache Avro MessageConverter, without a predefined schema:
|
||||
|
||||
Here is an example of configuring it in a sink application registering the Apache Avro `MessageConverter`, without a predefined schema:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user