Add special handling for JSON Strings

Added support to JsonMessageConverter to pass string as is if input type is String
Added guard condition to RSocketListenerFunction to avoid NPE if target function can not be discovered
This commit is contained in:
Oleg Zhurakousky
2020-08-31 16:35:18 +02:00
parent 6a13436723
commit 85b591cb89
2 changed files with 11 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry
import org.springframework.messaging.Message;
import org.springframework.messaging.rsocket.annotation.support.RSocketFrameTypeMessageCondition;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.Assert;
@@ -50,6 +51,10 @@ class RSocketListenerFunction implements Function<Message<Flux<byte[]>>, Publish
@Override
public Publisher<?> apply(Message<Flux<byte[]>> input) {
Assert.isTrue(this.targetFunction != null, "Failed to discover target function. \n"
+ "To fix it you should either provide 'spring.cloud.function.definition' property "
+ "or if you are using RSocketRequester provide valid function definition via 'route' "
+ "operator (e.g., requester.route(\"echo\"))");
FrameType frameType = RSocketFrameTypeMessageCondition.getFrameType(input);
switch (frameType) {
case REQUEST_FNF: