I have the following piece of code:
@Configuration
@EnableConfigurationProperties(ISOGatewayProperties::class)
class ISOGatewayConfig {
@Bean
fun isoGatewayFlow(
isoProps: ISOGatewayProperties,
isoTransformer: ISOTransformer) : IntegrationFlow =
IntegrationFlows
.from(MessageChannels.direct("isoInChannel"))
.log()
.transform(isoTransformer)
.handle(Tcp.outboundGateway(
Tcp.netClient(isoProps.host, isoProps.port)))
.get()
}
This code correctly converts the request which is an object to a byte[] for sending to the remote server
My questions are the following:
Answered by Artem The correct way of doing custom protocols is to use custom serializer/deserializer.
You just need to add a .transform(...)
after that .handle(Tcp.outboundGateway(...))
in the flow.
Well, you can use the same class for both request and response, but I believe in case of response you need to create an ISO object from the byte[]
, therefore you would need to specify a method name as a second .transform()
argument to make things clear for the target transformation endpoint.