List of usage examples for org.springframework.integration.dsl IntegrationFlows from
public static IntegrationFlowBuilder from(Publisher<Message<?>> publisher)
From source file:soap.client.Application.java
@Bean public IntegrationFlow convert() { return IntegrationFlows.from("requestChannel").transform(payload -> myPayload).handle(webserviceGate()) .transform(Transformers.xpath("//return/text()")).get(); }
From source file:org.springframework.cloud.netflix.hystrix.amqp.HystrixStreamAutoConfiguration.java
@Bean public IntegrationFlow hystrixStreamOutboundFlow() { return IntegrationFlows.from("hystrixStream") // TODO: set content type /*/*from www .j a v a 2 s.co m*/ * .enrichHeaders(new ComponentConfigurer<HeaderEnricherSpec>() { * * @Override public void configure(HeaderEnricherSpec spec) { * spec.header("content-type", "application/json", true); } }) */ .handle(Amqp.outboundAdapter(amqpTemplate()).exchangeName(HystrixConstants.HYSTRIX_STREAM_NAME)) .get(); }
From source file:com.netflix.spring.sample.membership.Membership.java
@Bean public IntegrationFlow controlBusFlow() { return IntegrationFlows.from("control").controlBus((config) -> config.autoStartup(true).id("controlBus")) .get();/*from www .j a v a2s. co m*/ }
From source file:org.openwms.common.comm.app.DriverConfig.java
@Bean IntegrationFlow inboundFlow(TelegramTransformer telegramTransformer) { return IntegrationFlows.from("inboundChannel").transform(telegramTransformer) .channel("transformerOutputChannel").route("messageRouter").get(); }
From source file:org.openwms.common.comm.app.DriverConfig.java
@Bean IntegrationFlow outboundFlow(HeaderAppendingTransformer headerAppendingTransformer) { return IntegrationFlows.from("outboundChannel").transform(headerAppendingTransformer) .channel("enrichedOutboundChannel").get(); }
From source file:ru.jts_dev.authserver.config.AuthIntegrationConfig.java
/** * Outgoing message flow/*from ww w . java 2 s . c o m*/ * * @return - complete message transformations flow */ @Bean public IntegrationFlow sendFlow() { return IntegrationFlows.from(packetChannel()).transform(OutgoingMessageWrapper.class, msg -> { msg.write(); return msg; }).transform(OutgoingMessageWrapper.class, msg -> { encoder.appendBlowFishPadding(msg.getPayload()); return msg; }).route(OutgoingMessageWrapper.class, msg -> msg instanceof Init, invoker -> invoker .subFlowMapping("true", sf -> sf.transform(Init.class, i -> encoder.encWithXor(i.getPayload())) .enrichHeaders(singletonMap(STATIC_KEY_HEADER, true))) .subFlowMapping("false", sf -> sf.transform(OutgoingMessageWrapper.class, msg -> encoder.appendChecksum(msg.getPayload())))) .transform(ByteBuf.class, buf -> { byte[] data = new byte[buf.readableBytes()]; buf.readBytes(data); buf.release(); return data; }).transform(encoder, "encrypt").headerFilter(STATIC_KEY_HEADER).channel(tcpOutChannel()).get(); }
From source file:ru.jts_dev.gameserver.config.GameIntegrationConfig.java
/** * Outgoing message flow/* w w w .j a va2 s . co m*/ * // TODO rewrite to reactive * * @return - complete message transformations flow */ @Bean public IntegrationFlow sendFlow(@Qualifier("packetChannel") MessageChannel packetChannel, @Qualifier("tcpOutChannel") MessageChannel tcpOutputChannel) { return IntegrationFlows.from(packetChannel) .route(OutgoingMessageWrapper.class, msg -> msg.isStatic(), invoker -> invoker .subFlowMapping("true", sf -> sf.transform(StaticOutgoingMessageWrapper.class, msg -> { try { return msg.clone(); } catch (CloneNotSupportedException e) { // just rethrow to unchecked throw new RuntimeException(e); } })).subFlowMapping("false", sf -> sf.transform(OutgoingMessageWrapper.class, msg -> msg))) .transform(OutgoingMessageWrapper.class, msg -> { msg.write(); return msg; }).route(OutgoingMessageWrapper.class, msg -> msg instanceof VersionCheck, // TODO: 14.12.15 unencrypted LoginFail invoker -> invoker .subFlowMapping("true", sf -> sf.transform(OutgoingMessageWrapper.class, OutgoingMessageWrapper::getPayload)) .subFlowMapping("false", sf -> sf.transform(OutgoingMessageWrapper.class, OutgoingMessageWrapper::getPayload).transform(encoder, "encrypt"))) .transform(ByteBuf.class, buf -> { byte[] data = new byte[buf.readableBytes()]; buf.readBytes(data); buf.release(); return data; }).channel(tcpOutputChannel).get(); }
From source file:ru.jts_dev.authserver.config.AuthIntegrationConfig.java
/** * Ingoing message flow// w w w.j a v a 2 s .co m * * @return - complete message transformation flow */ @Bean public IntegrationFlow recvFlow() { return IntegrationFlows.from(tcpInputChannel()).transform(encoder, "decrypt") .transform(byte[].class, b -> wrappedBuffer(b).order(ByteOrder.LITTLE_ENDIAN)) .transform(ByteBuf.class, encoder::validateChecksum).transform(clientPacketHandler, "handle") .channel(incomingPacketExecutorChannel()).get(); }
From source file:org.springframework.batch.integration.partition.RemotePartitioningWorkerStepBuilder.java
/** * Create an {@link IntegrationFlow} with a {@link StepExecutionRequestHandler} * configured as a service activator listening to the input channel and replying * on the output channel.//w w w . j a v a 2s. c o m */ private void configureWorkerIntegrationFlow() { Assert.notNull(this.inputChannel, "An InputChannel must be provided"); Assert.notNull(this.jobExplorer, "A JobExplorer must be provided"); if (this.stepLocator == null) { BeanFactoryStepLocator beanFactoryStepLocator = new BeanFactoryStepLocator(); beanFactoryStepLocator.setBeanFactory(this.beanFactory); this.stepLocator = beanFactoryStepLocator; } if (this.outputChannel == null) { if (logger.isDebugEnabled()) { logger.debug("The output channel is set to a NullChannel. " + "The master step must poll the job repository for workers status."); } this.outputChannel = new NullChannel(); } StepExecutionRequestHandler stepExecutionRequestHandler = new StepExecutionRequestHandler(); stepExecutionRequestHandler.setJobExplorer(this.jobExplorer); stepExecutionRequestHandler.setStepLocator(this.stepLocator); StandardIntegrationFlow standardIntegrationFlow = IntegrationFlows.from(this.inputChannel) .handle(stepExecutionRequestHandler, SERVICE_ACTIVATOR_METHOD_NAME).channel(this.outputChannel) .get(); IntegrationFlowContext integrationFlowContext = this.beanFactory.getBean(IntegrationFlowContext.class); integrationFlowContext.registration(standardIntegrationFlow).autoStartup(false).register(); }
From source file:org.springframework.cloud.stream.app.ftp.sink.FtpSinkConfiguration.java
@Bean public IntegrationFlow ftpInboundFlow(FtpSinkProperties properties, SessionFactory<FTPFile> ftpSessionFactory) { FtpMessageHandlerSpec handlerSpec = Ftp .outboundAdapter(new FtpRemoteFileTemplate(ftpSessionFactory), properties.getMode()) .remoteDirectory(properties.getRemoteDir()).remoteFileSeparator(properties.getRemoteFileSeparator()) .autoCreateDirectory(properties.isAutoCreateDir()) .temporaryFileSuffix(properties.getTmpFileSuffix()); if (properties.getFilenameExpression() != null) { handlerSpec.fileNameExpression(properties.getFilenameExpression().getExpressionString()); }/*from w w w . j ava 2 s .c o m*/ return IntegrationFlows.from(Sink.INPUT) .handle(handlerSpec, new Consumer<GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>>>() { @Override public void accept(GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>> e) { e.autoStartup(false); } }).get(); }