Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.18.0
    • Component/s: camel-flink
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Hello,

      I have created an Apache Flink component for Camel which makes it easier to use Flink for analytics. One can use DataSet callbacks with Spring beans/OSGI services.

      Using Spring's application context, it can be accessed like

      @Bean
      public DataSetCallback<Long> countLinesContaining() {
          return new DataSetCallback<Long>() {
              public Long onDataSet(DataSet dataSet, Object... objects) {
                  try {
                      dataSet.print();
                      return new Long(0);
                  } catch (Exception e) {
                      return new Long(-1);
                  }
              }
          };
      }
      
      @Bean
      public DataSet myDataSet() {
          final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
      
          DataSet<String> text = env.fromElements(
                  "Who's there?",
                  "I think I hear them. Stand ho! Who's there?");
      
          return text;
      }
      
      

      The results can be accessed like

      Long count = template.requestBody("flink:dataSet?dataSet=#myDataSet&dataSetCallback=#countLinesContaining", pattern, Long.class);
      

      Please review & accept my contribution.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              sbcd90 Subhobrata Dey
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: