Example usage for org.springframework.integration.dsl IntegrationFlows from

List of usage examples for org.springframework.integration.dsl IntegrationFlows from

Introduction

In this page you can find the example usage for org.springframework.integration.dsl IntegrationFlows from.

Prototype

public static IntegrationFlowBuilder from(Publisher<Message<?>> publisher) 

Source Link

Document

Populate a FluxMessageChannel to the IntegrationFlowBuilder chain and subscribe it to the provided Publisher .

Usage

From source file:com.acme.ModuleConfiguration.java

@Bean
public IntegrationFlow myFlow() {
    return IntegrationFlows.from(this.input()).transform(transformer).channel(this.output()).get();
}

From source file:org.springframework.cloud.consul.bus.ConsulBusAutoConfiguration.java

@Bean
public IntegrationFlow cloudBusConsulOutboundFlow(
        @Qualifier("cloudBusOutboundChannel") MessageChannel cloudBusOutboundChannel) {
    return IntegrationFlows.from(cloudBusOutboundChannel)
            // TODO: put the json headers as part of the message, here?
            .transform(Transformers.toJson()).handle(consulOutboundEndpoint()).get();
}

From source file:rest.json.Application.java

@Bean
public IntegrationFlow flow() {
    return IntegrationFlows.from("requestChannel").handle(new GenericHandler<Message>() {
        @Override/*from  www. ja va  2  s  .c  om*/
        public Object handle(Message payload, Map<String, Object> headers) {
            System.out.println(payload.getPayload().getClass() + " " + payload.getPayload());
            return payload;
        }

    }).channel("TestChannel1").transform(new JsonToObjectTransformer(User.class))
            .handle(new GenericHandler<Message>() {
                @Override
                public Object handle(Message payload, Map<String, Object> headers) {
                    System.out.println(
                            "XXXXXXXXX" + payload.getPayload() + " " + payload.getPayload().getClass());
                    return payload;
                }
            }).get();
}

From source file:org.springframework.cloud.consul.bus.ConsulBusAutoConfiguration.java

@Bean
public IntegrationFlow cloudBusConsulInboundFlow() {
    return IntegrationFlows.from(consulInboundChannelAdapter())
            .transform(Transformers.fromJson(RemoteApplicationEvent.class,
                    new Jackson2JsonObjectMapper(objectMapper)))
            .channel(cloudBusInboundChannel) // now set in consulInboundChannelAdapter
            // bean
            .get();//from  ww w. ja  v a2s  . c o m
}

From source file:simple.flow.Application.java

@Bean
public IntegrationFlow flow() {
    return IntegrationFlows.from("requestChannel1").handle(new GenericHandler<Message>() {
        @Override/*from  w  w w .j a v  a2 s  . com*/
        public Object handle(Message payload, Map<String, Object> headers) {
            System.out
                    .println("requestChannel1 " + payload.getPayload().getClass() + " " + payload.getPayload());
            return payload;
        }
    }).get();
}

From source file:rest.json.Application.java

@Bean
public IntegrationFlow testXChannel1() {
    return IntegrationFlows.from("TestChannel1").handle(new GenericHandler<Message>() {
        @Override/*from   ww  w.  j a va2s.com*/
        public Object handle(Message payload, Map<String, Object> headers) {
            System.out.println("TestChannel1: " + payload.getPayload() + " " + payload.getPayload().getClass());
            return payload;
        }
    }).channel("TestChannel2").get();
}

From source file:simple.flow.Application.java

@Bean
public IntegrationFlow errorFlow() {
    return IntegrationFlows.from("requestChannel2").handle(new GenericHandler<Message>() {
        @Override//from w ww . jav  a  2  s . c o m
        public Object handle(Message payload, Map<String, Object> headers) {
            System.out
                    .println("requestChannel2 " + payload.getPayload().getClass() + " " + payload.getPayload());
            return payload;
        }
    }).get();
}

From source file:org.springframework.cloud.netflix.turbine.amqp.TurbineAmqpAutoConfiguration.java

@Bean
public IntegrationFlow hystrixStreamAggregatorInboundFlow() {
    return IntegrationFlows.from(
            Amqp.inboundAdapter(connectionFactory(), hystrixStreamQueue()).messageConverter(messageConverter()))
            .channel("hystrixStreamAggregator").get();
}

From source file:rest.json.Application.java

@Bean
public IntegrationFlow testXChannel2() {
    return IntegrationFlows.from("TestChannel2").handle(new GenericHandler<Message>() {
        @Override//from  ww w.  jav a 2  s . co m
        public Object handle(Message payload, Map<String, Object> headers) {
            System.out.println("TestChannel2: " + payload.getPayload() + " " + payload.getPayload().getClass());
            return payload;
        }
    }).channel("testXChannel3.input").get();
}

From source file:ru.jts_dev.gameserver.config.GameIntegrationConfig.java

/**
 * Ingoing message flow//  w w w .  j ava  2s .c  o m
 *
 * @return - complete message transformation flow
 */
@Bean
public IntegrationFlow recvFlow() {
    return IntegrationFlows.from(tcpInputChannel())
            .transform(byte[].class, b -> wrappedBuffer(b).order(ByteOrder.LITTLE_ENDIAN))
            // no crypt for RequestProtocolVersion
            .route(ByteBuf.class, b -> b.readableBytes() > 0 && b.getByte(0) == 0x0E,
                    invoker -> invoker.subFlowMapping("true", sf -> sf.transform(b -> b))
                            .subFlowMapping("false", sf -> sf.transform(encoder, "decrypt")))
            .transform(clientPacketHandler, "handle").channel(incomingPacketExecutorChannel()).get();
}