예제 #1
0
 @Bean
 public IntegrationFlow findEntityTags() {
   return IntegrationFlows.from(channels.neoFdGetEntityTags())
       // .transform(getTransformer())
       .handle(neoFindEntityTags())
       .get();
 }
  @Bean
  public IntegrationFlow evernoteIntegration() {
    return IntegrationFlows.from(
            this.evernoteMessageSource(),
            configurer ->
                configurer.poller(Pollers.fixedRate(pollIntervalInSeconds, TimeUnit.SECONDS)))
        .channel(this.inputChannel())
        .filter(Collection.class, source -> !source.isEmpty())
        .split()
        .transform(
            Note.class,
            source -> {
              String content = source.getContent();
              if (StringUtils.isNotBlank(content)) {
                Document enmlDocument = Jsoup.parse(content);
                Elements noteElements = enmlDocument.select("en-note");
                if (noteElements.size() == 1) {
                  Element noteElement = noteElements.get(0);
                  String wordsFromNote = noteElement.text();
                  if (StringUtils.isNotBlank(wordsFromNote)) {
                    return wordsFromNote;
                  }
                }
              }

              return source.getTitle();
            },
            configurer -> configurer.requiresReply(false))
        .filter(source -> source != null)
        .channel(wordRequestsChannel)
        .get();
  }
예제 #3
0
  @Bean
  public IntegrationFlow addEntityTag() {

    return IntegrationFlows.from(channels.neoFdAddEntityTag())
        .transform(getTransformer())
        .handle(fdAddEntityTagRequest())
        .get();
  }
 @Bean
 public IntegrationFlow actionsSenderFlow() {
   MessageHandler jmsOutboundAdapter = jmsConfiguration.jmsOutboundAdapter();
   Destination actionProcessorDestination = jmsConfiguration.actionProcessorDestination();
   return IntegrationFlows.from(actionsSenderFlowInputChannel())
       .enrichHeaders(
           headerEnricherSpec ->
               headerEnricherSpec
                   .header(JmsHeaders.REPLY_TO, actionProcessorDestination)
                   .header(actionTypeHeaderName, TimedAction.empty().getTypeId()))
       .split()
       .transform(toTimedActionTransformer())
       .handle(jmsOutboundAdapter)
       .get();
 }
 @Bean
 public IntegrationFlow eventIntegrationFlow() {
   return IntegrationFlows.from(jmsInboundAdapterOutputChannel())
       .handle(
           message -> {
             TimedEvent timedEvent = ((TimedEvent) message.getPayload());
             Page<ActionEntity<?>> page =
                 actionRepository.findByEvent(timedEvent, new PageRequest(0, pageSize));
             while (page.hasNext()) {
               actionsSenderFlowInputChannel()
                   .send(MessageBuilder.withPayload(page.getContent()).build());
               page = actionRepository.findByEvent(timedEvent, page.nextPageable());
             }
           })
       .get();
 }
  @Bean
  public IntegrationFlow preProcessorAFlow(
      MessageChannel preProcessorAMessageChannel,
      final ProcessChainRoutingSlipRouteStrategy preProcessingRoutingSlipRouteStrategy) {
    preProcessingRoutingSlipRouteStrategy.registerMessageChannel(preProcessorAMessageChannel);

    return IntegrationFlows.from(preProcessorAMessageChannel)
        .transform(
            new GenericTransformer<String, String>() {
              @Override
              public String transform(String source) {
                return source + "->pre-process A";
              }
            })
        .get();
  }
예제 #7
0
 @Bean
 public IntegrationFlow inboundFlow() {
   return IntegrationFlows.from(Amqp.inboundGateway(connectionFactory, rabbitConfig.rubeQueue()))
       .transform((String s) -> s.toUpperCase())
       .get();
 }