java - Transformer not accepting Message as the input -
i've begun migrating java dsl we've used our project java 7 8, , i'm facing weird issues. have success channel expressionevaluatingrequesthandleradvice
expecting advicemessage
. in java 7 version, working fine with:
.transform(new generictransformer<advicemessage, message<?>>() { @override public message<?> transform(advicemessage source) { return source.getinputmessage(); } })
but when convert java 8:
.<advicemessage, message<?>>transform(advice -> advice.getinputmessage())
it gives me exception:
org.springframework.integration.handler.advice.expressionevaluatingrequesthandleradvice$ messagehandlingexpressionevaluatingadviceexception: handler failed; nested exception org.springframework.integration.transformer.messagetransformationexception: failed transform message; nested exception org.springframework.messaging.messagehandlingexception: nested exception java.lang.classcastexception: java.lang.boolean cannot cast org.springframework.integration.message.advicemessage
boolean result of success expression had given turns out method expecting payload , not letting me hold of whole message.
when tried change other parts of flow error consistently started popping wherever i've tried put generic argument expecting message<?>
instead of payload of message.
i can't figure out if i'm doing of java 8 syntax wrong, or error due else entirely, since java 7 version working perfectly.
i couldn't find java dsl examples on web there generic casts message instead of payload, don't know if it's supposed work.
thanks help.
that problem of genetics erasure. since 1 becomes object
, don't have choice unless try extract payload
message, because common use-case.
to fix concern have use overload.transform()
version advicemesaage.class
first argument.
that way know expected type , can make method invocation proper argument call.
Comments
Post a Comment